From 49b063a1879e749035dacf801f19de15dcd118dc Mon Sep 17 00:00:00 2001 From: Jordan Date: Sun, 15 Sep 2024 16:00:17 +0100 Subject: [PATCH] fix: compound tags can be nullable when converting state to baseblock (#2914) --- .../core/extent/filter/block/CharFilterBlock.java | 3 +-- .../com/fastasyncworldedit/core/world/block/CompoundInput.java | 3 +-- .../com/sk89q/worldedit/extent/AbstractDelegateExtent.java | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java index b1862987f..74571af05 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/extent/filter/block/CharFilterBlock.java @@ -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(); } diff --git a/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java index 481f8d54f..eff3c3de6 100644 --- a/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java +++ b/worldedit-core/src/main/java/com/fastasyncworldedit/core/world/block/CompoundInput.java @@ -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()); } }; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java index 267734247..89c450a10 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/AbstractDelegateExtent.java @@ -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