mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2025-07-04 00:45:57 +00:00
implement BukkitProtoWorld
This commit is contained in:
parent
bf0ac5afe2
commit
a52271dfb9
@ -4,4 +4,7 @@ import com.dfsek.terra.api.world.access.WorldAccess;
|
|||||||
|
|
||||||
|
|
||||||
public interface ProtoWorld extends WorldAccess {
|
public interface ProtoWorld extends WorldAccess {
|
||||||
|
int centerChunkX();
|
||||||
|
|
||||||
|
int centerChunkZ();
|
||||||
}
|
}
|
||||||
|
@ -20,6 +20,8 @@ package com.dfsek.terra.bukkit.generator;
|
|||||||
import org.bukkit.Chunk;
|
import org.bukkit.Chunk;
|
||||||
import org.bukkit.World;
|
import org.bukkit.World;
|
||||||
import org.bukkit.generator.BlockPopulator;
|
import org.bukkit.generator.BlockPopulator;
|
||||||
|
import org.bukkit.generator.LimitedRegion;
|
||||||
|
import org.bukkit.generator.WorldInfo;
|
||||||
import org.jetbrains.annotations.NotNull;
|
import org.jetbrains.annotations.NotNull;
|
||||||
|
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@ -44,4 +46,9 @@ public class BukkitPopulatorWrapper extends BlockPopulator {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void populate(@NotNull WorldInfo worldInfo, @NotNull Random random, int x, int z, @NotNull LimitedRegion limitedRegion) {
|
||||||
|
super.populate(worldInfo, random, x, z, limitedRegion);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,66 @@
|
|||||||
|
package com.dfsek.terra.bukkit.world;
|
||||||
|
|
||||||
|
import com.dfsek.terra.api.block.entity.BlockEntity;
|
||||||
|
import com.dfsek.terra.api.block.state.BlockState;
|
||||||
|
import com.dfsek.terra.api.world.chunk.generation.ProtoWorld;
|
||||||
|
|
||||||
|
import com.dfsek.terra.bukkit.world.block.data.BukkitBlockState;
|
||||||
|
|
||||||
|
import com.dfsek.terra.bukkit.world.block.state.BukkitBlockEntity;
|
||||||
|
|
||||||
|
import org.bukkit.generator.LimitedRegion;
|
||||||
|
|
||||||
|
|
||||||
|
public class BukkitProtoWorld implements ProtoWorld {
|
||||||
|
private final LimitedRegion delegate;
|
||||||
|
|
||||||
|
public BukkitProtoWorld(LimitedRegion delegate) { this.delegate = delegate; }
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LimitedRegion getHandle() {
|
||||||
|
return delegate;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setBlockData(int x, int y, int z, BlockState data, boolean physics) {
|
||||||
|
delegate.setBlockData(x, y, z, BukkitAdapter.adapt(data));
|
||||||
|
if(physics) {
|
||||||
|
delegate.scheduleBlockUpdate(x, y, z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long getSeed() {
|
||||||
|
return delegate.getWorld().getSeed();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMaxHeight() {
|
||||||
|
return delegate.getWorld().getMaxHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockState getBlockData(int x, int y, int z) {
|
||||||
|
return BukkitBlockState.newInstance(delegate.getBlockData(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BlockEntity getBlockState(int x, int y, int z) {
|
||||||
|
return BukkitBlockEntity.newInstance(delegate.getBlockState(x, y, z));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getMinHeight() {
|
||||||
|
return delegate.getWorld().getMinHeight();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int centerChunkX() {
|
||||||
|
return delegate.getCenterChunkX();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int centerChunkZ() {
|
||||||
|
return delegate.getCenterChunkZ();
|
||||||
|
}
|
||||||
|
}
|
@ -43,10 +43,6 @@ public class BukkitWorld implements World {
|
|||||||
this.delegate = delegate;
|
this.delegate = delegate;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getName() {
|
|
||||||
return delegate.getName();
|
|
||||||
}
|
|
||||||
|
|
||||||
public UUID getUID() {
|
public UUID getUID() {
|
||||||
return delegate.getUID();
|
return delegate.getUID();
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user