From e7d55ca87da642f27a35adc23f875090c1503541 Mon Sep 17 00:00:00 2001 From: wizjany Date: Tue, 26 Mar 2013 11:48:23 -0400 Subject: [PATCH] Add compatibility for MCPC-Plus 1.5.1 --- .../nmsblocks/MCPCPlusXNmsBlock_151.class | Bin 0 -> 10504 bytes ...ck_147.java => MCPCPlusXNmsBlock_151.java} | 202 ++++++++++-------- 2 files changed, 108 insertions(+), 94 deletions(-) create mode 100644 src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.class rename src/main/resources/nmsblocks/{MCPCPlusXNmsBlock_147.java => MCPCPlusXNmsBlock_151.java} (59%) diff --git a/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.class b/src/main/resources/nmsblocks/MCPCPlusXNmsBlock_151.class new file mode 100644 index 0000000000000000000000000000000000000000..3f8f95c2d36e379111a120b6e3ee6f997221cd07 GIT binary patch literal 10504 zcmb7K33yc1_5YohNnYm7V+$mZ5J=dwKsE>oK@k!_0wGXB380uxl1UgdnMr3RK-8+W zb*W41(#5#6)!I@kt%`I88mm}aZS7udYwfnnaoTW@cZZcGVi^6&OQ4% z_uTv53vYbxDFAiGs$BfV!e8+>6MuJNKK^0hGx(>v`)TG6hERix(%AI&bDyW@QDyB=--LhP%vZPvSa;27*kUE9C+>{j-)=Is4 zSgABxz44UFMC1Bx@I87NcESca8N4yeb27Os#(7H*XhWjx*$ z$Q4TcD_wGxtTN>tF5D#7n(|I{z0Q<(DO6txOmU+{qij+}xXF_D$jugQ z(xz;1izTGHOv@uhQ=xi<%BvIH+{G*D3eOGE?r)l@FWp5mP=Y$ngdG`#nKHQQPJ21MceK zu-8|u#=QRi>NX8qEtuL97#s==`+K*#hcH38M_%{zCx`&;7d zNGs=nC+O`P5oDE>?-e*&0=*u=ls3+4A0F)X1b4c-eH@w85q9?sP(J<4WaiWhynb(Z zji9!ywY7~ZREGu{SG~RZU?Ax0_4Inf)!jj&P7JqJcE~1o~X!Bo)0} zSu|lwnpI(kG`*OxC8@%mg{*bk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|( z3Z3!}e$jL_E|qK0BiAwuuEVwRF5D&8;~u$zZ(wgiRNjNH%Pm}>ZpEweUi^)pKRFo7 zF1b@?%3V?{@8?%%ACMOLploD(Z{l}O+hkNcaTb8 zjt4MPFI5j>ie9MB(do*kG~*m(6>^0g@A-bme(d*LxnoW5AW5rkvg9Z}^#q!xHyOnjQ?Y7Y}@>l!$E5j&!_gsmrZ9h0zyebENY#YWAZ iYj3BCKb(ePvQ;qfC(bqSXL>;Gb%Y= amq.p.length) { + public static net.minecraft.block.Block getNmsBlock(int type) { + if (type < 0 || type >= net.minecraft.block.Block.field_71973_m.length) { return null; } - return amq.p[type]; + return net.minecraft.block.Block.field_71973_m[type]; } /** @@ -266,25 +280,25 @@ public class MCPCPlusXNmsBlock_147 extends NmsBlock { * @return native WorldEdit NBT structure */ @SuppressWarnings("unchecked") - private static Tag toNative(cd foreign) { + private static Tag toNative(NBTBase foreign) { if (foreign == null) { return null; } - if (foreign instanceof bq) { + if (foreign instanceof NBTTagCompound) { Map values = new HashMap(); Collection foreignValues = null; if (compoundMapField == null) { try { // Method name may change! - foreignValues = ((bq) foreign).c(); + foreignValues = ((NBTTagCompound) foreign).func_74758_c(); } catch (Throwable t) { try { - logger.warning("WorldEdit: Couldn't get bq.c(), " + + logger.warning("WorldEdit: Couldn't get NBTTagCompound.func_74758_c(), " + "so we're going to try to get at the 'map' field directly from now on"); if (compoundMapField == null) { - compoundMapField = bq.class.getDeclaredField("map"); + compoundMapField = NBTTagCompound.class.getDeclaredField("field_74784_a"); compoundMapField.setAccessible(true); } } catch (Throwable e) { @@ -304,44 +318,44 @@ public class MCPCPlusXNmsBlock_147 extends NmsBlock { } for (Object obj : foreignValues) { - cd base = (cd) obj; - values.put(base.e(), toNative(base)); + NBTBase base = (NBTBase) obj; + values.put(base.func_74740_e(), toNative(base)); } - return new CompoundTag(foreign.e(), values); - } else if (foreign instanceof bp) { - return new ByteTag(foreign.e(), ((bp) foreign).a); - } else if (foreign instanceof bo) { - return new ByteArrayTag(foreign.e(), - ((bo) foreign).a); - } else if (foreign instanceof bt) { - return new DoubleTag(foreign.e(), - ((bt) foreign).a); - } else if (foreign instanceof bv) { - return new FloatTag(foreign.e(), ((bv) foreign).a); - } else if (foreign instanceof bx) { - return new IntTag(foreign.e(), ((bx) foreign).a); - } else if (foreign instanceof bw) { - return new IntArrayTag(foreign.e(), - ((bw) foreign).a); - } else if (foreign instanceof by) { + return new CompoundTag(foreign.func_74740_e(), values); + } else if (foreign instanceof NBTTagByte) { + return new ByteTag(foreign.func_74740_e(), ((NBTTagByte) foreign).field_74756_a); + } else if (foreign instanceof NBTTagByteArray) { + return new ByteArrayTag(foreign.func_74740_e(), + ((NBTTagByteArray) foreign).field_74754_a); + } else if (foreign instanceof NBTTagDouble) { + return new DoubleTag(foreign.func_74740_e(), + ((NBTTagDouble) foreign).field_74755_a); + } else if (foreign instanceof NBTTagFloat) { + return new FloatTag(foreign.func_74740_e(), ((NBTTagFloat) foreign).field_74750_a); + } else if (foreign instanceof NBTTagInt) { + return new IntTag(foreign.func_74740_e(), ((NBTTagInt) foreign).field_74748_a); + } else if (foreign instanceof NBTTagIntArray) { + return new IntArrayTag(foreign.func_74740_e(), + ((NBTTagIntArray) foreign).field_74749_a); + } else if (foreign instanceof NBTTagList) { List values = new ArrayList(); - by foreignList = (by) foreign; + NBTTagList foreignList = (NBTTagList) foreign; int type = NBTConstants.TYPE_BYTE; - for (int i = 0; i < foreignList.c(); i++) { - cd foreignTag = foreignList.b(i); + for (int i = 0; i < foreignList.func_74745_c(); i++) { + NBTBase foreignTag = foreignList.func_74743_b(i); values.add(toNative(foreignTag)); - type = foreignTag.a(); + type = foreignTag.func_74732_a(); } Class cls = NBTConstants.getClassFromType(type); - return new ListTag(foreign.e(), cls, values); - } else if (foreign instanceof bz) { - return new LongTag(foreign.e(), ((bz) foreign).a); - } else if (foreign instanceof cb) { - return new ShortTag(foreign.e(), ((cb) foreign).a); - } else if (foreign instanceof cc) { - return new StringTag(foreign.e(), - ((cc) foreign).a); - } else if (foreign instanceof bu) { + return new ListTag(foreign.func_74740_e(), cls, values); + } else if (foreign instanceof NBTTagLong) { + return new LongTag(foreign.func_74740_e(), ((NBTTagLong) foreign).field_74753_a); + } else if (foreign instanceof NBTTagShort) { + return new ShortTag(foreign.func_74740_e(), ((NBTTagShort) foreign).field_74752_a); + } else if (foreign instanceof NBTTagString) { + return new StringTag(foreign.func_74740_e(), + ((NBTTagString) foreign).field_74751_a); + } else if (foreign instanceof NBTTagEnd) { return new EndTag(); } else { throw new IllegalArgumentException("Don't know how to make native " @@ -355,53 +369,53 @@ public class MCPCPlusXNmsBlock_147 extends NmsBlock { * @param foreign structure to convert * @return non-native structure */ - private static cd fromNative(Tag foreign) { + private static NBTBase fromNative(Tag foreign) { if (foreign == null) { return null; } if (foreign instanceof CompoundTag) { - bq tag = new bq(foreign.getName()); + NBTTagCompound tag = new NBTTagCompound(foreign.getName()); for (Map.Entry entry : ((CompoundTag) foreign) .getValue().entrySet()) { - tag.a(entry.getKey(), fromNative(entry.getValue())); + tag.func_74782_a(entry.getKey(), fromNative(entry.getValue())); } return tag; } else if (foreign instanceof ByteTag) { - return new bp(foreign.getName(), + return new NBTTagByte(foreign.getName(), ((ByteTag) foreign).getValue()); } else if (foreign instanceof ByteArrayTag) { - return new bo(foreign.getName(), + return new NBTTagByteArray(foreign.getName(), ((ByteArrayTag) foreign).getValue()); } else if (foreign instanceof DoubleTag) { - return new bt(foreign.getName(), + return new NBTTagDouble(foreign.getName(), ((DoubleTag) foreign).getValue()); } else if (foreign instanceof FloatTag) { - return new bv(foreign.getName(), + return new NBTTagFloat(foreign.getName(), ((FloatTag) foreign).getValue()); } else if (foreign instanceof IntTag) { - return new bx(foreign.getName(), + return new NBTTagInt(foreign.getName(), ((IntTag) foreign).getValue()); } else if (foreign instanceof IntArrayTag) { - return new bw(foreign.getName(), + return new NBTTagIntArray(foreign.getName(), ((IntArrayTag) foreign).getValue()); } else if (foreign instanceof ListTag) { - by tag = new by(foreign.getName()); + NBTTagList tag = new NBTTagList(foreign.getName()); ListTag foreignList = (ListTag) foreign; for (Tag t : foreignList.getValue()) { - tag.a(fromNative(t)); + tag.func_74742_a(fromNative(t)); } return tag; } else if (foreign instanceof LongTag) { - return new bz(foreign.getName(), + return new NBTTagLong(foreign.getName(), ((LongTag) foreign).getValue()); } else if (foreign instanceof ShortTag) { - return new cb(foreign.getName(), + return new NBTTagShort(foreign.getName(), ((ShortTag) foreign).getValue()); } else if (foreign instanceof StringTag) { - return new cc(foreign.getName(), + return new NBTTagString(foreign.getName(), ((StringTag) foreign).getValue()); } else if (foreign instanceof EndTag) { - return new bu(); + return new NBTTagEnd(); } else { throw new IllegalArgumentException("Don't know how to make NMS " + foreign.getClass().getCanonicalName()); @@ -409,7 +423,7 @@ public class MCPCPlusXNmsBlock_147 extends NmsBlock { } public static boolean isValidBlockType(int type) throws NoClassDefFoundError { - return type == 0 || (type >= 1 && type < amq.p.length - && amq.p[type] != null); + return type == 0 || (type >= 1 && type < net.minecraft.block.Block.field_71973_m.length + && net.minecraft.block.Block.field_71973_m[type] != null); } -} +}