mirror of
https://github.com/PolyhedralDev/Terra.git
synced 2026-02-16 02:20:57 +00:00
fix: ignore the block when out of bounds
This commit is contained in:
@@ -21,6 +21,13 @@ public record AllayChunk(ServerWorld world, Chunk allayChunk) implements com.dfs
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayChunk.getDimensionInfo();
|
||||
if (x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllayBlockState allayBlockState = (AllayBlockState) data;
|
||||
allayChunk.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
if(allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER)) {
|
||||
|
||||
@@ -7,7 +7,7 @@ import com.dfsek.terra.api.world.ServerWorld;
|
||||
|
||||
|
||||
/**
|
||||
* NOTICE: Entity is not supported currently, and this is a fake implementation.
|
||||
* TODO: Entity is not supported currently, and this is a fake implementation.
|
||||
*
|
||||
* @author daoge_cmd
|
||||
*/
|
||||
|
||||
@@ -26,6 +26,13 @@ public record AllayProtoChunk(UnsafeChunk allayChunk) implements ProtoChunk {
|
||||
|
||||
@Override
|
||||
public void setBlock(int x, int y, int z, @NotNull BlockState blockState) {
|
||||
var dimensionInfo = allayChunk.getDimensionInfo();
|
||||
if (x < 0 || x > 15 ||
|
||||
z < 0 || z > 15 ||
|
||||
y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllayBlockState allayBlockState = (AllayBlockState) blockState;
|
||||
allayChunk.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
if(allayBlockState.containsWater() || allayChunk.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER)) {
|
||||
|
||||
@@ -43,6 +43,11 @@ public record AllayProtoWorld(AllayServerWorld allayServerWorld, OtherChunkAcces
|
||||
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayServerWorld.allayDimension().getDimensionInfo();
|
||||
if (y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
AllayBlockState allayBlockState = (AllayBlockState) data;
|
||||
context.setBlockState(x, y, z, allayBlockState.allayBlockState());
|
||||
if(allayBlockState.containsWater() || context.getBlockState(x, y, z).getBlockType().hasBlockTag(BlockTags.WATER)) {
|
||||
|
||||
@@ -27,6 +27,11 @@ public record AllayServerWorld(AllayGeneratorWrapper allayGeneratorWrapper, Dime
|
||||
|
||||
@Override
|
||||
public void setBlockState(int x, int y, int z, BlockState data, boolean physics) {
|
||||
var dimensionInfo = allayDimension.getDimensionInfo();
|
||||
if (y < dimensionInfo.minHeight() || y > dimensionInfo.maxHeight()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// In dimension#setBlockState() method, Water will be moved to layer 1 if it is placed at layer 0
|
||||
allayDimension.setBlockState(x, y, z, ((AllayBlockState) data).allayBlockState());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user