From aee18dfa7917ada0be8acd444401dc12b55debda Mon Sep 17 00:00:00 2001 From: pahimar Date: Fri, 21 Dec 2012 14:01:23 -0500 Subject: [PATCH] Discovered that in world transmutation isn't exactly great, have to come up with a good resolution --- .../ee3/core/helper/TransmutationHelper.java | 46 ++++--------------- .../com/pahimar/ee3/item/ItemMiniumStone.java | 2 +- .../ee3/item/ItemPhilosopherStone.java | 2 +- .../ee3/network/packet/PacketResultEvent.java | 2 +- 4 files changed, 13 insertions(+), 39 deletions(-) diff --git a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java b/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java index 1bfb8939..ea3b76f4 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java +++ b/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java @@ -61,11 +61,11 @@ public class TransmutationHelper { else if ((material == Material.pumpkin) && (id == Block.pumpkin.blockID)) { meta = 0; } - + currentBlockStack = new ItemStack(id, 1, meta); - + System.out.format("%d %d\n", id, meta); - + if (previousBlockStack == null) { previousBlockStack = currentBlockStack; targetBlockStack = getNextBlock(currentBlockStack.itemID, currentBlockStack.getItemDamage()); @@ -80,23 +80,18 @@ public class TransmutationHelper { public static ItemStack getNextBlock(int id, int meta) { - return getNextBlock(id, meta, true); - } - - public static ItemStack getNextBlock(int id, int meta, boolean allowFalling) { - ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); ItemStack nextStack = null; if (list != null) { - return getNextBlock(id, meta, id, meta, allowFalling); + return getNextBlock(id, meta, id, meta); } return nextStack; } - private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta, boolean allowFalling) { + private static ItemStack getNextBlock(int id, int meta, int origId, int origMeta) { ArrayList list = EquivalencyHandler.instance().getEquivalencyList(id, meta); @@ -104,7 +99,8 @@ public class TransmutationHelper { if (list != null) { nextStack = EquivalencyHandler.instance().getNextInList(id, meta); - + nextStack.stackSize = 1; + /* * If the current item is the same as the original one we started * with, then we have recursed through the entire list and not found @@ -115,33 +111,11 @@ public class TransmutationHelper { return nextStack; } else { - /* - * If we are allowing any block (including falling ones) just - * check to see if the next item is a block. If it is, return - * it. Otherwise continue the recursion. - */ - if (allowFalling) { - if (nextStack.getItem() instanceof ItemBlock) { - return nextStack; - } - else { - return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling); - } + if (nextStack.getItem() instanceof ItemBlock) { + return nextStack; } - /* - * Else we need to check to make sure the next item is both a - * block and not an instance of BlockSand (which all gravity - * affected blocks are a subclass of. If the next item is a - * block, and is not a subclass of BlockSand return it, - * otherwise, continue the recursion. - */ else { - if ((nextStack.getItem() instanceof ItemBlock) && (!(Block.blocksList[nextStack.itemID] instanceof BlockSand))) { - return nextStack; - } - else { - return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta, allowFalling); - } + return getNextBlock(nextStack.itemID, nextStack.getItemDamage(), origId, origMeta); } } } diff --git a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java index 4375ca26..15fa489d 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java @@ -101,7 +101,7 @@ public class ItemMiniumStone extends ItemEE } else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_TOGGLE)) { if (TransmutationHelper.targetBlockStack != null) { - TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage(), true); + TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); } } diff --git a/ee3_common/com/pahimar/ee3/item/ItemPhilosopherStone.java b/ee3_common/com/pahimar/ee3/item/ItemPhilosopherStone.java index b4b5a1d2..7de5052a 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemPhilosopherStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemPhilosopherStone.java @@ -180,7 +180,7 @@ public class ItemPhilosopherStone extends ItemEE } else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_TOGGLE)) { if (TransmutationHelper.targetBlockStack != null) { - TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage(), true); + TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); } } else if (keyBinding.equals(ConfigurationSettings.KEYBINDING_CHARGE)) { diff --git a/ee3_common/com/pahimar/ee3/network/packet/PacketResultEvent.java b/ee3_common/com/pahimar/ee3/network/packet/PacketResultEvent.java index 8a134509..5bfe2c4a 100644 --- a/ee3_common/com/pahimar/ee3/network/packet/PacketResultEvent.java +++ b/ee3_common/com/pahimar/ee3/network/packet/PacketResultEvent.java @@ -45,7 +45,7 @@ public class PacketResultEvent extends PacketEE { System.out.println(shouldChangeNextBlock); if (shouldChangeNextBlock) { System.out.format("previous %d:%d, current %d:%d, target %d:%d\n", TransmutationHelper.previousBlockStack.itemID, TransmutationHelper.previousBlockStack.getItemDamage(), TransmutationHelper.currentBlockStack.itemID, TransmutationHelper.currentBlockStack.getItemDamage(), TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); - TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage(), true); + TransmutationHelper.targetBlockStack = TransmutationHelper.getNextBlock(TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); System.out.format("previous %d:%d, current %d:%d, target %d:%d\n", TransmutationHelper.previousBlockStack.itemID, TransmutationHelper.previousBlockStack.getItemDamage(), TransmutationHelper.currentBlockStack.itemID, TransmutationHelper.currentBlockStack.getItemDamage(), TransmutationHelper.targetBlockStack.itemID, TransmutationHelper.targetBlockStack.getItemDamage()); } }