From e7ae3b4ddfdf0fe46e89bc0696cb8663f64561e3 Mon Sep 17 00:00:00 2001 From: wizjany Date: Sat, 30 Mar 2013 15:48:06 -0400 Subject: [PATCH] Fix setting blocks that used multiple TileEntities on one block id. Since forge added support for this feature, we need to double-pass on setting block data values to preserve both TileEntity type and block orientations. Users using MCPC may need to remove their old MCPC nmsblock class before the new one is used correctly. (Although it was only added in a dev build) --- .../worldedit/bukkit/DefaultNmsBlock.java | 2 +- ...51.class => MCPCPlusXNmsBlock_151dv.class} | Bin 10504 -> 10513 bytes ..._151.java => MCPCPlusXNmsBlock_151dv.java} | 18 +++++++++--------- 3 files changed, 10 insertions(+), 10 deletions(-) rename src/main/resources/nmsblocks/{MCPCPlusXNmsBlock_151.class => MCPCPlusXNmsBlock_151dv.class} (76%) rename src/main/resources/nmsblocks/{MCPCPlusXNmsBlock_151.java => MCPCPlusXNmsBlock_151dv.java} (93%) diff --git a/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java b/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java index d064b7af6..ce25f5920 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java @@ -253,7 +253,7 @@ public class DefaultNmsBlock extends NmsBlock { // TileEntity te = craftWorld.getHandle().getTileEntity(x, y, z); // craftWorld.getHandle().tileEntityList.remove(te); - boolean changed = craftWorld.getHandle().setTypeIdAndData(x, y, z, block.getId(), 0, 0); + boolean changed = craftWorld.getHandle().setTypeIdAndData(x, y, z, block.getId(), block.getData(), 0); if (block instanceof BaseBlock) { world.copyToWorld(position, (BaseBlock) block); diff --git a/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.class b/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151dv.class similarity index 76% rename from src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.class rename to src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151dv.class index 3f8f95c2d36e379111a120b6e3ee6f997221cd07..b68088e83e2f248e34b1cacd4c9123d5c1c6f4ca 100644 GIT binary patch delta 204 zcmeAOniw=;ot{3UBo~7|qZAi|5~DO1qadRU7o#kr92cWJPy$FuaWV2UDzGyuf`pYe z-brL(^qy?T>cNy!wz-X!mx)nkav`fIh_{kGn~_l*#?#__BF6cLft`Vqfq`N2WN`&8 zEuC!)y3E@c^vpPP4l?M^WZ>1();YkSzm35lT#|hogPbUfD61$NNY&&Fg#dAMT|h(S8Cd@_xNd%@AjJUy3EM5) delta 192 zcmbOj)Dbjcot_?}Bo~7oqZAi|5~DO1qadRU7o#kr92cWJP=b-4QGuON5hS7n5|P?? zCy|BGbFv+)$L0=JUM5DV$%U+1<;#m|Uokpk~PMiNS*5GlLVu lH-;33?+m#NKNzYRelqkj{9)JyG*O;`^*@8t=I;tp900=~DmDNB diff --git a/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.java b/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151dv.java similarity index 93% rename from src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.java rename to src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151dv.java index fc664a728..364eb9fa5 100644 --- a/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.java +++ b/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151dv.java @@ -50,7 +50,7 @@ import com.sk89q.worldedit.foundation.Block; /** * Remapping tools are broken atm. */ -public class MCPCPlusXNmsBlock_151 extends NmsBlock { +public class MCPCPlusXNmsBlock_151dv extends NmsBlock { private static final Logger logger = WorldEdit.logger; private static Field compoundMapField; @@ -86,7 +86,7 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { * @param data data value * @param tileEntityBlock tile entity block */ - public MCPCPlusXNmsBlock_151(int type, int data, TileEntityBlock tileEntityBlock) { + public MCPCPlusXNmsBlock_151dv(int type, int data, TileEntityBlock tileEntityBlock) { super(type, data); nbtData = (NBTTagCompound) fromNative(tileEntityBlock.getNbtData()); @@ -100,7 +100,7 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { * @param data data value * @param nbtData raw NBT data */ - public MCPCPlusXNmsBlock_151(int type, int data, NBTTagCompound nbtData) { + public MCPCPlusXNmsBlock_151dv(int type, int data, NBTTagCompound nbtData) { super(type, data); this.nbtData = nbtData; @@ -164,7 +164,7 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { * @param data data value of block * @return the block, or null */ - public static MCPCPlusXNmsBlock_151 get(World world, Vector position, int type, int data) { + public static MCPCPlusXNmsBlock_151dv get(World world, Vector position, int type, int data) { if (!hasTileEntity(type)) { return null; } @@ -175,7 +175,7 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { if (te != null) { NBTTagCompound tag = new NBTTagCompound(); te.func_70310_b(tag); // Load data - return new MCPCPlusXNmsBlock_151(type, data, tag); + return new MCPCPlusXNmsBlock_151dv(type, data, tag); } return null; @@ -195,11 +195,11 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { return false; } - if (block instanceof MCPCPlusXNmsBlock_151) { - MCPCPlusXNmsBlock_151 nmsProxyBlock = (MCPCPlusXNmsBlock_151) block; + if (block instanceof MCPCPlusXNmsBlock_151dv) { + MCPCPlusXNmsBlock_151dv nmsProxyBlock = (MCPCPlusXNmsBlock_151dv) block; data = nmsProxyBlock.getNmsData(position); } else if (block instanceof TileEntityBlock) { - MCPCPlusXNmsBlock_151 nmsProxyBlock = new MCPCPlusXNmsBlock_151( + MCPCPlusXNmsBlock_151dv nmsProxyBlock = new MCPCPlusXNmsBlock_151dv( block.getId(), block.getData(), block); data = nmsProxyBlock.getNmsData(position); } @@ -237,7 +237,7 @@ public class MCPCPlusXNmsBlock_151 extends NmsBlock { // TileEntity te = craftWorld.getHandle().getTileEntity(x, y, z); // craftWorld.getHandle().tileEntityList.remove(te); - boolean changed = craftWorld.getHandle().func_72832_d(x, y, z, block.getId(), 0, 0); + boolean changed = craftWorld.getHandle().func_72832_d(x, y, z, block.getId(), block.getData(), 0); if (block instanceof BaseBlock) { world.copyToWorld(position, (BaseBlock) block);