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

Dieser Commit ist enthalten in:
Jordan 2024-09-15 16:00:17 +01:00 committet von GitHub
Ursprung f820cb2fb4
Commit 49b063a187
Es konnte kein GPG-Schlüssel zu dieser Signatur gefunden werden
GPG-Schlüssel-ID: B5690EEEBB952194
3 geänderte Dateien mit 3 neuen und 5 gelöschten Zeilen

Datei anzeigen

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

Datei anzeigen

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

Datei anzeigen

@ -427,7 +427,7 @@ public class AbstractDelegateExtent implements Extent {
@Override @Override
public boolean tile(int x, int y, int z, FaweCompoundTag tile) throws WorldEditException { 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 //FAWE end