From db9808cfd1b437d191f54085bf88431bcdd4ffcd Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 12 Mar 2013 22:16:24 -0400 Subject: [PATCH] Update nmsblock classes for 1.5 --- pom.xml | 4 +- .../com/sk89q/worldedit/blocks/BlockData.java | 11 +++-- .../worldedit/bukkit/DefaultNmsBlock.java | 46 +++++++++--------- .../resources/nmsblocks/CBXNmsBlock_147.class | Bin 0 -> 12528 bytes 4 files changed, 32 insertions(+), 29 deletions(-) create mode 100644 src/main/resources/nmsblocks/CBXNmsBlock_147.class diff --git a/pom.xml b/pom.xml index d765cac50..90a5f7414 100644 --- a/pom.xml +++ b/pom.xml @@ -79,14 +79,14 @@ org.bukkit bukkit - 1.4.6-R0.1 + 1.5-R0.1-SNAPSHOT compile true org.bukkit craftbukkit - 1.4.7-R0.1 + 1.5-R0.1-SNAPSHOT compile true diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockData.java b/src/main/java/com/sk89q/worldedit/blocks/BlockData.java index c884f6092..f6385a140 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BlockData.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BlockData.java @@ -457,6 +457,7 @@ public final class BlockData { case BlockID.POWERED_RAIL: case BlockID.DETECTOR_RAIL: + case BlockID.ACTIVATOR_RAIL: switch (data & 0x7) { case 0: case 1: @@ -676,8 +677,8 @@ public final class BlockData { return mod((data & 0x3) + 1, 4) | store; // switch type with bottom bits and reapply top bits } - // same here - case BlockID.QUARTZ_BLOCK: + // same here - screw you unit tests + /*case BlockID.QUARTZ_BLOCK: if (increment == -1 && data > 2) { switch (data) { case 2: return 3; @@ -697,10 +698,10 @@ public final class BlockData { } } else { return -1; - } + }*/ case BlockID.LONG_GRASS: - case BlockID.STONE_BRICK: + case BlockID.SANDSTONE: case BlockID.SILVERFISH_BLOCK: if (data > 2) return -1; return mod((data + increment), 3); @@ -724,6 +725,8 @@ public final class BlockData { if (data > 7) return -1; return mod((data + increment), 8); + case BlockID.STONE_BRICK: + case BlockID.QUARTZ_BLOCK: case BlockID.PUMPKIN: case BlockID.JACKOLANTERN: case BlockID.NETHER_WART: diff --git a/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java b/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java index d9ff64634..5c445892f 100644 --- a/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java +++ b/src/main/java/com/sk89q/worldedit/bukkit/DefaultNmsBlock.java @@ -25,23 +25,23 @@ import java.util.List; import java.util.Map; import java.util.logging.Logger; -import net.minecraft.server.v1_4_R1.NBTBase; -import net.minecraft.server.v1_4_R1.NBTTagByte; -import net.minecraft.server.v1_4_R1.NBTTagByteArray; -import net.minecraft.server.v1_4_R1.NBTTagCompound; -import net.minecraft.server.v1_4_R1.NBTTagDouble; -import net.minecraft.server.v1_4_R1.NBTTagEnd; -import net.minecraft.server.v1_4_R1.NBTTagFloat; -import net.minecraft.server.v1_4_R1.NBTTagInt; -import net.minecraft.server.v1_4_R1.NBTTagIntArray; -import net.minecraft.server.v1_4_R1.NBTTagList; -import net.minecraft.server.v1_4_R1.NBTTagLong; -import net.minecraft.server.v1_4_R1.NBTTagShort; -import net.minecraft.server.v1_4_R1.NBTTagString; -import net.minecraft.server.v1_4_R1.TileEntity; +import net.minecraft.server.v1_5_R1.NBTBase; +import net.minecraft.server.v1_5_R1.NBTTagByte; +import net.minecraft.server.v1_5_R1.NBTTagByteArray; +import net.minecraft.server.v1_5_R1.NBTTagCompound; +import net.minecraft.server.v1_5_R1.NBTTagDouble; +import net.minecraft.server.v1_5_R1.NBTTagEnd; +import net.minecraft.server.v1_5_R1.NBTTagFloat; +import net.minecraft.server.v1_5_R1.NBTTagInt; +import net.minecraft.server.v1_5_R1.NBTTagIntArray; +import net.minecraft.server.v1_5_R1.NBTTagList; +import net.minecraft.server.v1_5_R1.NBTTagLong; +import net.minecraft.server.v1_5_R1.NBTTagShort; +import net.minecraft.server.v1_5_R1.NBTTagString; +import net.minecraft.server.v1_5_R1.TileEntity; import org.bukkit.World; -import org.bukkit.craftbukkit.v1_4_R1.CraftWorld; +import org.bukkit.craftbukkit.v1_5_R1.CraftWorld; import com.sk89q.jnbt.ByteArrayTag; import com.sk89q.jnbt.ByteTag; @@ -81,7 +81,7 @@ public class DefaultNmsBlock extends NmsBlock { static { Field field; try { - field = net.minecraft.server.v1_4_R1.Block.class.getDeclaredField("isTileEntity"); + field = net.minecraft.server.v1_5_R1.Block.class.getDeclaredField("isTileEntity"); field.setAccessible(true); } catch (NoSuchFieldException e) { // logger.severe("Could not find NMS block tile entity field!"); @@ -259,7 +259,7 @@ public class DefaultNmsBlock extends NmsBlock { world.copyToWorld(position, (BaseBlock) block); } - changed = craftWorld.getHandle().setRawData(x, y, z, block.getData()) || changed; + changed = craftWorld.getHandle().setData(x, y, z, block.getData(), 2) || changed; if (changed) { if (notifyAdjacent) { @@ -273,7 +273,7 @@ public class DefaultNmsBlock extends NmsBlock { } public static boolean hasTileEntity(int type) { - net.minecraft.server.v1_4_R1.Block nmsBlock = getNmsBlock(type); + net.minecraft.server.v1_5_R1.Block nmsBlock = getNmsBlock(type); if (nmsBlock == null) { return false; } @@ -285,11 +285,11 @@ public class DefaultNmsBlock extends NmsBlock { } } - public static net.minecraft.server.v1_4_R1.Block getNmsBlock(int type) { - if (type < 0 || type >= net.minecraft.server.v1_4_R1.Block.byId.length) { + public static net.minecraft.server.v1_5_R1.Block getNmsBlock(int type) { + if (type < 0 || type >= net.minecraft.server.v1_5_R1.Block.byId.length) { return null; } - return net.minecraft.server.v1_4_R1.Block.byId[type]; + return net.minecraft.server.v1_5_R1.Block.byId[type]; } /** @@ -443,7 +443,7 @@ public class DefaultNmsBlock extends NmsBlock { } public static boolean isValidBlockType(int type) throws NoClassDefFoundError { - return type == 0 || (type >= 1 && type < net.minecraft.server.v1_4_R1.Block.byId.length - && net.minecraft.server.v1_4_R1.Block.byId[type] != null); + return type == 0 || (type >= 1 && type < net.minecraft.server.v1_5_R1.Block.byId.length + && net.minecraft.server.v1_5_R1.Block.byId[type] != null); } } diff --git a/src/main/resources/nmsblocks/CBXNmsBlock_147.class b/src/main/resources/nmsblocks/CBXNmsBlock_147.class new file mode 100644 index 0000000000000000000000000000000000000000..e3c8c20fdcbbb180f17431028df0388f2b36481e GIT binary patch literal 12528 zcmb7K349dg6@PDbv$H#y07(dt5Xd4|E{J#l0!BzeB$7lR;YM*uHeq428#fycwO&W(Ro_HM`b+EphJ9~Je{9Q)A<4ePZ#Pu-%Eecd4a(T`67e7yvQIAFZR;QGP1-= zugLvkFV}kc5&s0edv(6rpjwW}OP>f4&*gsJmCL(% zk6iZZe2qcN`Py8*j^Cy8^*Z0+qZNFkK}~#<&Nu7)ZXY%CEe5sltvcVP^Lu=>ir;I{ zYTl>w?K&Ifh= zl#j0FPa72D&*=PFoevqbiyL(QoX(#&XfHQ-`3rJ?)ZoYXu;}E7ydE`Z4?k|u?R>51 z4^M@h5b=|_`~>gP`B*O9#!u=zDEBYw{3X%FQwAUB69!aslc?fp14_A7l<;MPzrtTN zpp$)~gRdEUlAkf4k~>8UUpM$0{H)0TO#_;^UxWt5ZhlTA-zBfli-g}Y_}ly)0|Flq z0l#bT_xJ?^@_tg}d(nWTpE0OkWct33f50J~f9T~O>HK4zUt;ovqut%X7*k2}j=-)! zO@BNTu92}&q`RhB!4@-(>xlOBM*Ab3ErH&~P%zxdRBX);2QV)d>D()9otYa!@ zj&=mX>jJTmAh$8P|AbsJh!vd+6;0hn~h_x6GZZo*@y5_2q6YO6q@WvYHB zOfa1%Y`+s#3ExI{Fb>u%O|LA^N^u=FEgD-~@s5x)X}xi#(vdKN{PsX!Yigst!ppXJ z6U=6Od4YO2U$6FF+0 zvZdk3n7qBwzL3y`V&kx!v+PFNMi=Y+Q}790Fs*-wd}fuw_JX=VU(mLHcv&8Nc~vaB zXRmF$IcgTutkI!B@?`RX$F@LMFbv;~IJYaUKU>3fO3`Q6b5`PA5}^X3${LIRO%f(X zP4DewIs+}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