diff --git a/src/main/java/net/minestom/server/instance/AnvilLoader.java b/src/main/java/net/minestom/server/instance/AnvilLoader.java index 90262a9ce..18c339c34 100644 --- a/src/main/java/net/minestom/server/instance/AnvilLoader.java +++ b/src/main/java/net/minestom/server/instance/AnvilLoader.java @@ -125,16 +125,8 @@ public class AnvilLoader implements IChunkLoader { for (int y = 0; y < Chunk.CHUNK_SECTION_SIZE; y++) { try { final BlockState blockState = section.get(x, y, z); - Block block = Block.fromNamespaceId(blockState.getName()); - if (block == null) { - // Invalid block - continue; - } - final var properties = blockState.getProperties(); - if (!properties.isEmpty()) { - block = block.withProperties(properties); - } - chunk.setBlock(x, y + yOffset, z, block); + chunk.setBlock(x, y + yOffset, z, + Block.fromNamespaceId(blockState.getName()).withProperties(blockState.getProperties())); } catch (Exception e) { EXCEPTION_MANAGER.handleException(e); } diff --git a/src/main/java/net/minestom/server/instance/block/BlockImpl.java b/src/main/java/net/minestom/server/instance/block/BlockImpl.java index a8344fb56..966a50428 100644 --- a/src/main/java/net/minestom/server/instance/block/BlockImpl.java +++ b/src/main/java/net/minestom/server/instance/block/BlockImpl.java @@ -58,6 +58,9 @@ final class BlockImpl implements Block { @Override public @NotNull Block withProperties(@NotNull Map<@NotNull String, @NotNull String> properties) { + if (properties.isEmpty()) { + return this; + } Block block; if (this.properties.size() == properties.size()) { // Map should be complete