diff --git a/worldedit-bukkit/src/main/resources/worldedit-adapters.jar b/worldedit-bukkit/src/main/resources/worldedit-adapters.jar index 499403c17..cc42ab3c0 100644 Binary files a/worldedit-bukkit/src/main/resources/worldedit-adapters.jar and b/worldedit-bukkit/src/main/resources/worldedit-adapters.jar differ diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java index a13667eb8..092bc94d0 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/FastSchematicWriter.java @@ -159,15 +159,16 @@ public class FastSchematicWriter implements ClipboardWriter { if (nbt != null) { Map values = nbt.getValue(); - values.remove("id"); // Remove 'id' if it exists. We want 'Id' - // Positions are kept in NBT, we don't want that. values.remove("x"); values.remove("y"); values.remove("z"); - if (!values.containsKey("Id")) { - values.put("Id", new StringTag(block.getNbtId())); - } + values.put("Id", new StringTag(block.getNbtId())); + + // Remove 'id' if it exists. We want 'Id'. + // Do this after we get "getNbtId" cos otherwise "getNbtId" doesn't work. + // Dum. + values.remove("id"); values.put("Pos", new IntArrayTag(new int[]{ pos.getX(), pos.getY(), diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index 36af08c10..c4dda7db1 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -49,13 +49,8 @@ import static com.google.common.base.Preconditions.checkNotNull; */ public class BaseBlock implements BlockStateHolder, TileEntityBlock { - private BlockState blockState; - @Nullable private CompoundTag nbtData; - - @Deprecated - public BaseBlock() { - this(BlockTypes.AIR.getDefaultState()); - } + private final BlockState blockState; + @Nullable private final CompoundTag nbtData; /** * Construct a block with the given type and default data. @@ -151,6 +146,9 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return ""; } Tag idTag = nbtData.getValue().get("id"); + if (idTag == null) { + idTag = nbtData.getValue().get("Id"); + } if (idTag instanceof StringTag) { return ((StringTag) idTag).getValue(); } else { @@ -164,6 +162,11 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return this.nbtData; } + @Override + public void setNbtData(@Nullable CompoundTag nbtData) { + throw new UnsupportedOperationException("This class is immutable."); + } + /** * Checks whether the type ID and data value are equal. */