fix: compound tags can be nullable when converting state to baseblock (#2914)

This commit is contained in:
Jordan 2024-09-15 16:00:17 +01:00 committed by GitHub
parent f820cb2fb4
commit 49b063a187
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 3 additions and 5 deletions

View File

@ -263,8 +263,7 @@ public class CharFilterBlock extends ChunkFilterBlock {
final BlockMaterial material = state.getMaterial();
if (material.hasContainer()) {
final FaweCompoundTag tag = get.tile(x, y + yy, z);
assert tag != null : "has container but is null";
return state.toBaseBlock(tag.linTag());
return state.toBaseBlock(tag == null ? null : tag.linTag());
}
return state.toBaseBlock();
}

View File

@ -17,8 +17,7 @@ public enum CompoundInput {
@Override
public BaseBlock get(final BlockState state, final IBlocks blocks, final int x, final int y, final int z) {
final FaweCompoundTag tile = blocks.tile(x, y, z);
assert tile != null : "container without tile entity";
return state.toBaseBlock(tile.linTag());
return state.toBaseBlock(tile == null ? null : tile.linTag());
}
};

View File

@ -427,7 +427,7 @@ public class AbstractDelegateExtent implements Extent {
@Override
public boolean tile(int x, int y, int z, FaweCompoundTag tile) throws WorldEditException {
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile.linTag()));
return setBlock(x, y, z, getBlock(x, y, z).toBaseBlock(tile == null ? null : tile.linTag()));
}
//FAWE end