From f54d6afb65642395fb9dfe8eb8fde3d8a6233e5e Mon Sep 17 00:00:00 2001 From: Matthew Miller Date: Fri, 10 Aug 2018 20:29:06 +1000 Subject: [PATCH] Make BaseBlock more memory efficient, and make it clear in the API that it's not intended to be used for every single block. --- .../worldedit/bukkit/BukkitBlockRegistry.java | 2 +- .../sk89q/worldedit/bukkit/BukkitPlayer.java | 4 +- .../sk89q/worldedit/bukkit/BukkitWorld.java | 4 +- .../bukkit/adapter/BukkitImplAdapter.java | 2 +- .../bukkit/adapter/impl/Spigot_v1_13_R1.class | Bin 20266 -> 20257 bytes .../worldedit/blocks/MobSpawnerBlock.java | 1 + .../com/sk89q/worldedit/blocks/SignBlock.java | 1 + .../sk89q/worldedit/blocks/SkullBlock.java | 1 + .../java/com/sk89q/worldedit/EditSession.java | 2 +- .../java/com/sk89q/worldedit/WorldEdit.java | 2 +- .../worldedit/command/RegionCommands.java | 1 - .../command/tool/brush/GravityBrush.java | 4 +- .../tool/brush/HollowCylinderBrush.java | 3 +- .../command/tool/brush/HollowSphereBrush.java | 3 +- .../command/tool/brush/SphereBrush.java | 3 +- .../com/sk89q/worldedit/entity/Player.java | 2 +- .../extension/factory/BlockFactory.java | 2 +- .../extension/factory/DefaultBlockParser.java | 2 +- .../platform/AbstractPlayerActor.java | 6 +-- .../extent/AbstractDelegateExtent.java | 2 +- .../worldedit/extent/ChangeSetExtent.java | 2 +- .../sk89q/worldedit/extent/InputExtent.java | 2 +- .../sk89q/worldedit/extent/NullExtent.java | 4 +- .../extent/clipboard/BlockArrayClipboard.java | 10 ++-- .../clipboard/io/MCEditSchematicReader.java | 4 +- .../clipboard/io/SpongeSchematicReader.java | 4 +- .../clipboard/io/SpongeSchematicWriter.java | 2 +- .../transform/BlockTransformExtent.java | 2 +- .../function/block/ExtentBlockCopy.java | 4 +- .../operation/BlockMapEntryPlacer.java | 2 +- .../function/pattern/BlockPattern.java | 2 +- .../internal/command/WorldEditBinding.java | 2 +- .../com/sk89q/worldedit/world/NullWorld.java | 4 +- .../{blocks => world/block}/BaseBlock.java | 44 ++++++++++-------- .../worldedit/world/block/BlockState.java | 20 ++++++++ .../world/block/BlockStateHolder.java | 18 ++++++- .../worldedit/world/block/BlockType.java | 2 +- .../worldedit/world/chunk/AnvilChunk.java | 4 +- .../sk89q/worldedit/world/chunk/Chunk.java | 2 +- .../sk89q/worldedit/world/chunk/OldChunk.java | 6 +-- .../registry}/BlockMaterial.java | 2 +- .../world/registry/BlockRegistry.java | 1 - .../world/registry/BundledBlockData.java | 1 - .../world/registry/BundledBlockRegistry.java | 1 - .../registry/PassthroughBlockMaterial.java | 2 - .../world/registry/SimpleBlockMaterial.java | 2 - .../world/snapshot/SnapshotRestore.java | 2 +- .../com/sk89q/worldedit/forge/ForgeWorld.java | 6 +-- .../worldedit/forge/TileEntityBaseBlock.java | 2 +- .../sk89q/worldedit/sponge/SpongeWorld.java | 2 +- 50 files changed, 118 insertions(+), 90 deletions(-) rename worldedit-core/src/main/java/com/sk89q/worldedit/{blocks => world/block}/BaseBlock.java (86%) rename worldedit-core/src/main/java/com/sk89q/worldedit/{blocks => world/registry}/BlockMaterial.java (98%) diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java index 32f73967c..6f272af72 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitBlockRegistry.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.bukkit; -import com.sk89q.worldedit.blocks.BlockMaterial; +import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockType; import com.sk89q.worldedit.world.registry.BundledBlockRegistry; diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java index 7eed49eba..7066da770 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitPlayer.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.bukkit; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extension.platform.AbstractPlayerActor; @@ -70,7 +70,7 @@ public class BukkitPlayer extends AbstractPlayerActor { ItemStack itemStack = handSide == HandSide.MAIN_HAND ? player.getInventory().getItemInMainHand() : player.getInventory().getItemInOffHand(); - return new BaseBlock(BukkitAdapter.asBlockState(itemStack)); + return BukkitAdapter.asBlockState(itemStack).toBaseBlock(); } @Override diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java index db20f6ac3..c0d16dddb 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/BukkitWorld.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.bukkit.adapter.BukkitImplAdapter; import com.sk89q.worldedit.entity.BaseEntity; @@ -443,7 +443,7 @@ public class BukkitWorld extends AbstractWorld { if (adapter != null) { return adapter.getBlock(BukkitAdapter.adapt(getWorld(), position)); } else { - return new BaseBlock(getBlock(position)); + return getBlock(position).toBaseBlock(); } } diff --git a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java index f16a6716e..4a30a11c0 100644 --- a/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java +++ b/worldedit-bukkit/src/main/java/com/sk89q/worldedit/bukkit/adapter/BukkitImplAdapter.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.bukkit.adapter; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockStateHolder; diff --git a/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class b/worldedit-bukkit/src/main/resources/com/sk89q/worldedit/bukkit/adapter/impl/Spigot_v1_13_R1.class index d34f1bccd43da481f64a7c24d610403219627d8a..9655a35a6d5e15fdcb7d712e127fb6aef5b7ceea 100644 GIT binary patch delta 7902 zcmZu$34ByV@~*0$nND6_APFR7fP@=E4#Q=Tpxl>85JAK!sNqnMBS3u@zc zYWcAQj#`c-at+sN<34SybNF$7)Zr)iNiCjoxSsbrG=iVj+A|J6%aP|CYR?BOKd;Xh zRP+~Zd{GMwc!^(j_!WLti`Vq^b%)>JHywV9-?sdYKHt^iJuTkX;)5jqkPkZi5r6E^ z3H*uWPaP`c&m8`ozp(tJL%r3^L;RH%k*_U(^4j-R47SUBuOGH#!3KMC5Ubka`-K=S|n(ZsD-0N5&#i5QIe$vERmLJM3U}EhO}`c z6H`c7+FEJn&@|qjAnoy#EPXiuKT5VXcW|VmbV`!WLRPw1>1w50QiSG6_aqdZ963R9 z9GWLRtmInB(~kLR#8Q|fJ*Af;y`_)V`dT^3p$hF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U+J?jv8 zqz>4K3;9}W#D$=a(kQ>BD3l)w`hYSh+Gv?02kNP?EI&?bl=s?7N~@=JWtg!xM(g9` zDRqNS-Kf+JF}gKQw<&d#PpwqyrWoBGr_D;e!>8V<)H`BySDfxvYOzn54u8~VvP+pf8lza8;!3Ucsdb=6sWwKt<5aKY$115sJ?$yWtE0!6 z;`D?P8!9Qep7w(0lSrM8x%^X!=!eIfV;&FC7j|&*{9vP#-wv}=qkDvS9#YQv@be1F z=8I`CFQn)wn0qpeeHJgFa+v!SA+P5v zaHE7kiPEX?t5G-|b8wVxDi}XKL_bVXc?Nh_6fgsV8G69&+e)1y$cO9bSw+HhczMFd>*zV5(rbfU zb>!XbT6(?+2wq(l3BucJqQ~$kkuYpSqPZPrs)8bRP*=VWaCATNfgMPh9-u+4hRV81%BZKc8f@!gbRb5r#_2Wf*yzXG2JP4wqu1l~hEgjrJX%kilw293 zH)HfxoZi-+JAFoXXvdu~dM8Hj#_2un*y48-YsZ!ty&t0wkWp*Lc7KI!+Oa)GAI9k; zrS9;lRZ86vqmSeCiBhX8skok+A)-GmiK44ov#x(6QmSLnncW1PuM`F0NysuG>u04^ zM?Ut2-Q{oPQRTfWMxV#%i#UC$?CboFTJ5Nd(N{70I!@nc#~yz-k7>uA82vL&|EkW5 z?xnqzl&zO39N0tOmKjq^|Hc)||G7hf^K9LRr ze}0b=XJuq%Wo2ae$b_i6+efBOzo8>5W2)sX`adA9;1a=vsK@mHI61iu^nD%uz@!Lr z+@%Y$1?|_h^~PoyZzBQ++~hTKC~D-8svMU4EMoLyE&cRYMiY)>l$u}!vH#{TcQ0?k zyEUL>zYOQwLioSZWSe%wBIZ`J+1y4E(eFoGeMmZ position.getBlockX() - size; --x) { for (double z = position.getBlockZ() + size; z > position.getBlockZ() - size; --z) { @@ -52,7 +50,7 @@ public class GravityBrush implements Brush { final BlockStateHolder block = editSession.getBlock(pt); if (block.getBlockType() != BlockTypes.AIR) { blockTypes.add(block); - editSession.setBlock(pt, air); + editSession.setBlock(pt, BlockTypes.AIR.getDefaultState()); } } Vector pt = new Vector(x, y, z); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java index 7da259c33..3f9eb06c7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowCylinderBrush.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockTypes; @@ -38,7 +37,7 @@ public class HollowCylinderBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeCylinder(position, pattern, size, size, height, false); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java index b5009221b..7980ec744 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/HollowSphereBrush.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockTypes; @@ -32,7 +31,7 @@ public class HollowSphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeSphere(position, pattern, size, size, size, false); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java index 781ee6d1f..ba4b3eaf2 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/command/tool/brush/SphereBrush.java @@ -22,7 +22,6 @@ package com.sk89q.worldedit.command.tool.brush; import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; import com.sk89q.worldedit.function.pattern.BlockPattern; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.block.BlockTypes; @@ -32,7 +31,7 @@ public class SphereBrush implements Brush { @Override public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException { if (pattern == null) { - pattern = new BlockPattern(new BaseBlock(BlockTypes.COBBLESTONE)); + pattern = new BlockPattern(BlockTypes.COBBLESTONE.getDefaultState()); } editSession.makeSphere(position, pattern, size, size, size, true); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java index 958f811fa..b803e93f5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/entity/Player.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.entity; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.extension.platform.Actor; import com.sk89q.worldedit.extent.inventory.BlockBag; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java index bc85f245a..aab3504f4 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/BlockFactory.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.extension.factory; import com.sk89q.util.StringUtil; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.internal.registry.AbstractFactory; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java index f7bf9770d..510656828 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/factory/DefaultBlockParser.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.IncompleteRegionException; import com.sk89q.worldedit.NotABlockException; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.MobSpawnerBlock; import com.sk89q.worldedit.blocks.SignBlock; import com.sk89q.worldedit.blocks.SkullBlock; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java index 4372b65b6..36e84ded7 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extension/platform/AbstractPlayerActor.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.extension.platform; import com.sk89q.worldedit.PlayerDirection; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.internal.cui.CUIEvent; @@ -367,9 +367,9 @@ public abstract class AbstractPlayerActor implements Actor, Player, Cloneable { public BaseBlock getBlockInHand(HandSide handSide) throws WorldEditException { final ItemType typeId = getItemInHand(handSide).getType(); if (typeId.hasBlockType()) { - return new BaseBlock(typeId.getBlockType()); + return typeId.getBlockType().getDefaultState().toBaseBlock(); } else { - return new BaseBlock(BlockTypes.AIR); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } } 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 a33c56fd5..a93c9b93d 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 @@ -24,7 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java index 590622a72..e4f6ba48d 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/ChangeSetExtent.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.history.change.BlockChange; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java index fc7d70081..61ea293c8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/InputExtent.java @@ -21,7 +21,7 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.function.pattern.Pattern; import com.sk89q.worldedit.world.biome.BaseBiome; import com.sk89q.worldedit.world.block.BlockState; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java index 2753948cd..93ffb6e94 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/NullExtent.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.extent; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; @@ -79,7 +79,7 @@ public class NullExtent implements Extent { @Override public BaseBlock getFullBlock(Vector position) { - return new BaseBlock(getBlock(position)); + return getBlock(position).toBaseBlock(); } @Nullable diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java index fc31c2886..eba334e5a 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/BlockArrayClipboard.java @@ -24,7 +24,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.function.operation.Operation; @@ -141,15 +141,11 @@ public class BlockArrayClipboard implements Clipboard { Vector v = position.subtract(region.getMinimumPoint()); BlockStateHolder block = blocks[v.getBlockX()][v.getBlockY()][v.getBlockZ()]; if (block != null) { - if (block instanceof BaseBlock) { - return (BaseBlock) block; - } else { - return new BaseBlock(block.toImmutableState()); - } + return block.toBaseBlock(); } } - return new BaseBlock(BlockTypes.AIR); + return BlockTypes.AIR.getDefaultState().toBaseBlock(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java index ba6d5ad3b..aaa4b387e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/MCEditSchematicReader.java @@ -33,7 +33,7 @@ import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; import com.sk89q.worldedit.extent.clipboard.Clipboard; @@ -227,7 +227,7 @@ public class MCEditSchematicReader extends NBTSchematicReader { try { if (state != null) { if (tileEntitiesMap.containsKey(pt)) { - clipboard.setBlock(region.getMinimumPoint().add(pt), new BaseBlock(state, new CompoundTag(tileEntitiesMap.get(pt)))); + clipboard.setBlock(region.getMinimumPoint().add(pt), state.toBaseBlock(new CompoundTag(tileEntitiesMap.get(pt)))); } else { clipboard.setBlock(region.getMinimumPoint().add(pt), state); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java index b68e09e43..c66203025 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicReader.java @@ -35,7 +35,7 @@ import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extension.input.InputParseException; import com.sk89q.worldedit.extension.input.ParserContext; import com.sk89q.worldedit.extent.clipboard.BlockArrayClipboard; @@ -209,7 +209,7 @@ public class SpongeSchematicReader extends NBTSchematicReader { values.put("id", values.get("Id")); values.remove("Id"); values.remove("Pos"); - clipboard.setBlock(pt, new BaseBlock(state, new CompoundTag(values))); + clipboard.setBlock(pt, state.toBaseBlock(new CompoundTag(values))); } else { clipboard.setBlock(pt, state); } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java index bf42c5a75..8ed384e5e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/clipboard/io/SpongeSchematicWriter.java @@ -32,7 +32,7 @@ import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.clipboard.Clipboard; import com.sk89q.worldedit.regions.Region; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java index a4630bb8d..7b44ce4b5 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/extent/transform/BlockTransformExtent.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.AbstractDelegateExtent; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.math.transform.Transform; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java index 70dbf6bb2..223b419b3 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/block/ExtentBlockCopy.java @@ -25,7 +25,7 @@ import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.CompoundTagBuilder; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.function.RegionFunction; import com.sk89q.worldedit.internal.helper.MCDirections; @@ -104,7 +104,7 @@ public class ExtentBlockCopy implements RegionFunction { builder.putByte("Rot", (byte) MCDirections.toRotation(newDirection)); - return new BaseBlock(state.toImmutableState(), builder.build()); + return state.toBaseBlock(builder.build()); } } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java index 1f3bf2a22..849f3f73f 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/operation/BlockMapEntryPlacer.java @@ -23,7 +23,7 @@ import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.extent.Extent; import com.sk89q.worldedit.world.block.BlockStateHolder; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java index ebab2aa5f..c45b90986 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/function/pattern/BlockPattern.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.function.pattern; import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.block.BlockStateHolder; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java index eb06a9455..664af4c4e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/internal/command/WorldEditBinding.java @@ -26,7 +26,7 @@ import com.sk89q.worldedit.UnknownDirectionException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.entity.Entity; import com.sk89q.worldedit.entity.Player; import com.sk89q.worldedit.extension.input.NoMatchException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java index 328784589..8161957e8 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/NullWorld.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity; @@ -126,7 +126,7 @@ public class NullWorld extends AbstractWorld { @Override public BaseBlock getFullBlock(Vector position) { - return new BaseBlock(getBlock(position)); + return getBlock(position).toBaseBlock(); } @Override diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java similarity index 86% rename from worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java index f8da3fc28..58d8d1235 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BaseBlock.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BaseBlock.java @@ -17,18 +17,16 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.blocks; +package com.sk89q.worldedit.world.block; + +import static com.google.common.base.Preconditions.checkNotNull; import com.sk89q.jnbt.CompoundTag; import com.sk89q.jnbt.StringTag; import com.sk89q.jnbt.Tag; +import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.function.mask.Mask; import com.sk89q.worldedit.registry.state.Property; -import com.sk89q.worldedit.world.block.BlockState; -import com.sk89q.worldedit.world.block.BlockStateHolder; -import com.sk89q.worldedit.world.block.BlockType; -import com.sk89q.worldedit.world.block.BlockTypes; -import com.sk89q.worldedit.world.registry.LegacyMapper; import java.util.Map; import java.util.Objects; @@ -52,33 +50,25 @@ import javax.annotation.Nullable; public class BaseBlock implements BlockStateHolder, TileEntityBlock { private BlockState blockState; - @Nullable CompoundTag nbtData; + @Nullable private CompoundTag nbtData; /** * Construct a block with a state. * * @param blockState The blockstate */ - public BaseBlock(BlockState blockState) { + protected BaseBlock(BlockState blockState) { this.blockState = blockState; } - /** - * Construct a block with the given type and default data. - * - * @param blockType The block type - */ - public BaseBlock(BlockType blockType) { - this.blockState = blockType.getDefaultState(); - } - /** * Construct a block with the given ID, data value and NBT data structure. * * @param state The block state - * @param nbtData NBT data, which may be null + * @param nbtData NBT data, which must be provided */ - public BaseBlock(BlockState state, @Nullable CompoundTag nbtData) { + protected BaseBlock(BlockState state, CompoundTag nbtData) { + checkNotNull(nbtData); this.blockState = state; this.nbtData = nbtData; } @@ -184,6 +174,22 @@ public class BaseBlock implements BlockStateHolder, TileEntityBlock { return this.blockState; } + @Override + public BaseBlock toBaseBlock() { + return this; + } + + @Override + public BaseBlock toBaseBlock(CompoundTag compoundTag) { + if (compoundTag == null) { + return this.blockState.toBaseBlock(); + } else if (compoundTag == this.nbtData) { + return this; + } else { + return new BaseBlock(this.blockState, compoundTag); + } + } + @Override public int hashCode() { int ret = toImmutableState().hashCode() << 3; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java index f32159e55..2b89d9195 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockState.java @@ -24,6 +24,7 @@ import com.google.common.collect.HashBasedTable; import com.google.common.collect.Lists; import com.google.common.collect.Maps; import com.google.common.collect.Table; +import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.WorldEdit; import com.sk89q.worldedit.registry.state.Property; @@ -47,12 +48,15 @@ public class BlockState implements BlockStateHolder { private final Map, Object> values; private final boolean fuzzy; + private BaseBlock emptyBaseBlock; + // Neighbouring state table. private Table, Object, BlockState> states; private BlockState(BlockType blockType) { this.blockType = blockType; this.values = new LinkedHashMap<>(); + this.emptyBaseBlock = new BaseBlock(this); this.fuzzy = false; } @@ -197,6 +201,22 @@ public class BlockState implements BlockStateHolder { return this; } + @Override + public BaseBlock toBaseBlock() { + if (this.fuzzy) { + throw new IllegalArgumentException("Can't create a BaseBlock from a fuzzy BlockState!"); + } + return this.emptyBaseBlock; + } + + @Override + public BaseBlock toBaseBlock(CompoundTag compoundTag) { + if (compoundTag == null) { + return toBaseBlock(); + } + return new BaseBlock(this, compoundTag); + } + /** * Internal method used for creating the initial BlockState. * diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java index b31888ee0..fe90a3c49 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockStateHolder.java @@ -19,6 +19,7 @@ package com.sk89q.worldedit.world.block; +import com.sk89q.jnbt.CompoundTag; import com.sk89q.worldedit.registry.state.Property; import java.util.Map; @@ -66,12 +67,27 @@ public interface BlockStateHolder { boolean equalsFuzzy(BlockStateHolder o); /** - * Returns an immutable BlockState from this BlockStateHolder. + * Returns an immutable {@link BlockState} from this BlockStateHolder. * * @return A BlockState */ BlockState toImmutableState(); + /** + * Gets a {@link BaseBlock} from this BlockStateHolder. + * + * @return The BaseBlock + */ + BaseBlock toBaseBlock(); + + /** + * Gets a {@link BaseBlock} from this BlockStateHolder. + * + * @param compoundTag The NBT Data to apply + * @return The BaseBlock + */ + BaseBlock toBaseBlock(CompoundTag compoundTag); + default String getAsString() { if (getStates().isEmpty()) { return this.getBlockType().getId(); diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java index 506c05ac0..a6ecd79dc 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/block/BlockType.java @@ -22,7 +22,7 @@ package com.sk89q.worldedit.world.block; import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableMap; import com.sk89q.worldedit.WorldEdit; -import com.sk89q.worldedit.blocks.BlockMaterial; +import com.sk89q.worldedit.world.registry.BlockMaterial; import com.sk89q.worldedit.extension.platform.Capability; import com.sk89q.worldedit.registry.NamespacedRegistry; import com.sk89q.worldedit.registry.state.Property; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java index ffc3f6791..0f0d70d05 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/AnvilChunk.java @@ -28,7 +28,7 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; @@ -262,7 +262,7 @@ public class AnvilChunk implements Chunk { BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, data); CompoundTag tileEntity = getBlockTileEntity(position); - return new BaseBlock(state, tileEntity); + return state.toBaseBlock(tileEntity); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java index 7cfca5005..6ba2e8a54 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/Chunk.java @@ -20,7 +20,7 @@ package com.sk89q.worldedit.world.chunk; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; /** diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java index 6094ac297..e11d0cefb 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/chunk/OldChunk.java @@ -27,7 +27,7 @@ import com.sk89q.jnbt.NBTUtils; import com.sk89q.jnbt.Tag; import com.sk89q.worldedit.BlockVector; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.world.DataException; import com.sk89q.worldedit.world.World; import com.sk89q.worldedit.world.block.BlockState; @@ -154,7 +154,7 @@ public class OldChunk implements Chunk { @Override public BaseBlock getBlock(Vector position) throws DataException { - if(position.getBlockY() >= 128) new BaseBlock(BlockTypes.AIR); + if(position.getBlockY() >= 128) BlockTypes.AIR.getDefaultState().toBaseBlock(); int id, dataVal; int x = position.getBlockX() - rootX * 16; @@ -183,7 +183,7 @@ public class OldChunk implements Chunk { BlockState state = LegacyMapper.getInstance().getBlockFromLegacy(id, dataVal); CompoundTag tileEntity = getBlockTileEntity(position); - return new BaseBlock(state, tileEntity); + return state.toBaseBlock(tileEntity); } } diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java similarity index 98% rename from worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java rename to worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java index aaf6dfca0..9f8d32a15 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockMaterial.java @@ -17,7 +17,7 @@ * along with this program. If not, see . */ -package com.sk89q.worldedit.blocks; +package com.sk89q.worldedit.world.registry; /** * Describes the material for a block. diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java index a871a2812..0e87b084e 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BlockRegistry.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java index 98987d191..afe73c368 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockData.java @@ -24,7 +24,6 @@ import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.google.gson.reflect.TypeToken; import com.sk89q.worldedit.Vector; -import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.util.gson.VectorAdapter; import java.io.IOException; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java index 1f1a2b317..40e123959 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/BundledBlockRegistry.java @@ -19,7 +19,6 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BlockMaterial; import com.sk89q.worldedit.registry.state.Property; import com.sk89q.worldedit.world.block.BlockType; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java index 1eaa65c1d..97dd617f9 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/PassthroughBlockMaterial.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BlockMaterial; - import javax.annotation.Nullable; public class PassthroughBlockMaterial implements BlockMaterial { diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java index 6e0b57e31..e0247ce49 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/registry/SimpleBlockMaterial.java @@ -19,8 +19,6 @@ package com.sk89q.worldedit.world.registry; -import com.sk89q.worldedit.blocks.BlockMaterial; - class SimpleBlockMaterial implements BlockMaterial { private boolean fullCube; diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java index d55e7815c..814818a5c 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/world/snapshot/SnapshotRestore.java @@ -24,7 +24,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.regions.CuboidRegion; import com.sk89q.worldedit.regions.Region; import com.sk89q.worldedit.world.DataException; diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java index 5c717c3ff..c35684059 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/ForgeWorld.java @@ -29,7 +29,7 @@ import com.sk89q.worldedit.MaxChangedBlocksException; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItem; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; @@ -388,7 +388,7 @@ public class ForgeWorld extends AbstractWorld { if (tile != null) { return new TileEntityBaseBlock(getBlock(position), tile); } else { - return new BaseBlock(getBlock(position)); + return getBlock(position).toBaseBlock(); } } @@ -405,7 +405,7 @@ public class ForgeWorld extends AbstractWorld { ForgeWorld other = ((ForgeWorld) o); World otherWorld = other.worldRef.get(); World thisWorld = worldRef.get(); - return otherWorld != null && thisWorld != null && otherWorld.equals(thisWorld); + return otherWorld != null && otherWorld.equals(thisWorld); } else if (o instanceof com.sk89q.worldedit.world.World) { return ((com.sk89q.worldedit.world.World) o).getName().equals(getName()); } else { diff --git a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java index 6aa0ff73a..c1700150f 100644 --- a/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java +++ b/worldedit-forge/src/main/java/com/sk89q/worldedit/forge/TileEntityBaseBlock.java @@ -19,7 +19,7 @@ package com.sk89q.worldedit.forge; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.TileEntityBlock; import com.sk89q.worldedit.world.block.BlockState; import net.minecraft.nbt.NBTTagCompound; diff --git a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java index c8bfc6366..fe3db9e16 100644 --- a/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java +++ b/worldedit-sponge/src/main/java/com/sk89q/worldedit/sponge/SpongeWorld.java @@ -27,7 +27,7 @@ import com.sk89q.worldedit.EditSession; import com.sk89q.worldedit.Vector; import com.sk89q.worldedit.Vector2D; import com.sk89q.worldedit.WorldEditException; -import com.sk89q.worldedit.blocks.BaseBlock; +import com.sk89q.worldedit.world.block.BaseBlock; import com.sk89q.worldedit.blocks.BaseItemStack; import com.sk89q.worldedit.entity.BaseEntity; import com.sk89q.worldedit.entity.Entity;