From 6a9f1ab2b97cf30ba235e94c4193f29e633ef28c Mon Sep 17 00:00:00 2001 From: Jeremy Diamond Date: Wed, 25 Feb 2015 20:36:39 -0800 Subject: [PATCH] Fixing API --- .../alchemicalWizardry/api/Int3.java | 44 ---- .../api/RoutingFocusLogic.java | 16 -- .../api/RoutingFocusLogicIgnMeta.java | 12 - .../api/RoutingFocusLogicMatchNBT.java | 17 -- .../api/RoutingFocusLogicModItems.java | 21 -- .../api/RoutingFocusParadigm.java | 60 ----- .../api/RoutingFocusPosAndFacing.java | 21 -- .../api/alchemy/energy/ReagentRegistry.java | 2 +- .../AltarRecipeRegistry.java | 11 +- .../api/altarRecipeRegistry/IFadedRune.java | 6 - .../api/compress/CompressionHandler.java | 14 -- .../api/compress/CompressionRegistry.java | 67 ----- .../api/event/ItemBindEvent.java | 2 - .../api/event/ItemDrainInContainerEvent.java | 15 -- .../api/event/TeleposeEvent.java | 56 ----- .../api/items/ItemSpellMultiTool.java | 22 +- .../api/items/ShapelessBloodOrbRecipe.java | 14 +- .../api/items/interfaces/ILPGauge.java | 8 - .../api/items/interfaces/IRitualDiviner.java | 14 -- .../api/renderer/MRSRenderer.java | 4 +- .../api/rituals/IMasterRitualStone.java | 8 - .../api/rituals/IRitualStone.java | 12 +- .../api/rituals/ITileRitualStone.java | 6 - .../api/rituals/LocalRitualStorage.java | 42 ---- .../api/rituals/RitualEffect.java | 34 --- .../api/rituals/Rituals.java | 115 ++++++--- .../soulNetwork/ComplexNetworkHandler.java | 126 ---------- .../api/soulNetwork/LifeEssenceNetwork.java | 4 - .../api/soulNetwork/SoulNetworkHandler.java | 128 ++-------- .../api/spell/APISpellHelper.java | 228 +----------------- .../api/spell/EntitySpellProjectile.java | 32 ++- .../api/spell/SpellEffectRegistry.java | 6 +- 32 files changed, 145 insertions(+), 1022 deletions(-) delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/Int3.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicIgnMeta.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicMatchNBT.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java delete mode 100644 src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/Int3.java b/src/api/java/WayofTime/alchemicalWizardry/api/Int3.java deleted file mode 100644 index 16facc0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/Int3.java +++ /dev/null @@ -1,44 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.nbt.NBTTagCompound; - - -public class Int3 -{ - public int xCoord; - public int yCoord; - public int zCoord; - - public Int3(int xCoord, int yCoord, int zCoord) - { - this.xCoord = xCoord; - this.yCoord = yCoord; - this.zCoord = zCoord; - } - - public static Int3 readFromNBT(NBTTagCompound tag) - { - return new Int3(tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); - } - - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { - tag.setInteger("xCoord", xCoord); - tag.setInteger("yCoord", yCoord); - tag.setInteger("zCoord", zCoord); - - return tag; - } - - @Override - public boolean equals(Object o) - { - return o instanceof Int3 ? ((Int3) o).xCoord == this.xCoord && ((Int3) o).yCoord == this.yCoord && ((Int3) o).zCoord == this.zCoord : false; - } - - @Override - public int hashCode() - { - return this.xCoord + this.yCoord << 8 + this.zCoord << 16; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java deleted file mode 100644 index a3f0a3e..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogic.java +++ /dev/null @@ -1,16 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.item.ItemStack; - -public class RoutingFocusLogic -{ - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) : false); - } - - public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) - { - return previous || this.getDefaultMatch(keyStack, checkedStack); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicIgnMeta.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicIgnMeta.java deleted file mode 100644 index 5a2c5dd..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicIgnMeta.java +++ /dev/null @@ -1,12 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.item.ItemStack; - -public class RoutingFocusLogicIgnMeta extends RoutingFocusLogic -{ - @Override - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() : false); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicMatchNBT.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicMatchNBT.java deleted file mode 100644 index 73b81b0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicMatchNBT.java +++ /dev/null @@ -1,17 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.item.ItemStack; - -public class RoutingFocusLogicMatchNBT extends RoutingFocusLogic -{ - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - return (keyStack != null ? checkedStack != null && keyStack.getItem() == checkedStack.getItem() && (keyStack.getItem().getHasSubtypes() ? keyStack.getItemDamage() == checkedStack.getItemDamage() : true) && keyStack.areItemStackTagsEqual(keyStack, checkedStack) : false); - } - - @Override - public boolean doesItemMatch(boolean previous, ItemStack keyStack, ItemStack checkedStack) - { - return previous && this.getDefaultMatch(keyStack, checkedStack); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java deleted file mode 100644 index 25bd70b..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusLogicModItems.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.registry.GameRegistry; -import cpw.mods.fml.common.registry.GameRegistry.UniqueIdentifier; - -public class RoutingFocusLogicModItems extends RoutingFocusLogic -{ - @Override - public boolean getDefaultMatch(ItemStack keyStack, ItemStack checkedStack) - { - if(keyStack != null && checkedStack != null) - { - UniqueIdentifier keyId = GameRegistry.findUniqueIdentifierFor(keyStack.getItem()); - UniqueIdentifier checkedId = GameRegistry.findUniqueIdentifierFor(checkedStack.getItem()); - return keyId.modId.equals(checkedId.modId); - } - - return false; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java deleted file mode 100644 index 8c467e8..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusParadigm.java +++ /dev/null @@ -1,60 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.item.ItemStack; - -public class RoutingFocusParadigm -{ - public List logicList = new LinkedList(); - - public List locationList = new LinkedList(); - - public int maximumAmount = 0; - - public void addRoutingFocusPosAndFacing(RoutingFocusPosAndFacing facing) - { - locationList.add(facing); - } - - public void addLogic(RoutingFocusLogic logic) - { - logicList.add(logic); - } - - public boolean doesItemMatch(ItemStack keyStack, ItemStack checkedStack) - { - boolean isGood = false; - boolean isFirst = true; - for(RoutingFocusLogic logic : logicList) - { - if(isFirst) - { - isGood = logic.getDefaultMatch(keyStack, checkedStack); - isFirst = false; - continue; - } - isGood = logic.doesItemMatch(isGood, keyStack, checkedStack); - } - - return isGood; - } - - public void clear() - { - logicList.clear(); - locationList.clear(); - maximumAmount = 0; - } - - public void setMaximumAmount(int amt) - { - this.maximumAmount = amt; - } - - public int getMaximumAmount() - { - return this.maximumAmount; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java b/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java deleted file mode 100644 index a6ee34a..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/RoutingFocusPosAndFacing.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraftforge.common.util.ForgeDirection; - -public class RoutingFocusPosAndFacing -{ - public Int3 location; - public ForgeDirection facing; - - public RoutingFocusPosAndFacing(Int3 location, ForgeDirection facing) - { - this.location = location; - this.facing = facing; - } - - @Override - public boolean equals(Object obj) - { - return obj instanceof RoutingFocusPosAndFacing ? facing.equals(((RoutingFocusPosAndFacing)obj).facing) && location.equals(((RoutingFocusPosAndFacing)obj).location) : false; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java index 20b4393..16306ef 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java @@ -49,7 +49,7 @@ public class ReagentRegistry sanctusReagent.setColour(255, 255, 0, 255); incendiumReagent.setColour(255, 0, 0, 255); - aquasalusReagent.setColour(0, 0, 255, 255); + aquasalusReagent.setColour(47, 0, 196, 255); magicalesReagent.setColour(150, 0, 146, 255); aetherReagent.setColour(105, 223, 86, 255); crepitousReagent.setColour(145, 145, 145, 255); diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java index e8426d1..d8077f3 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java @@ -1,16 +1,13 @@ package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; -import java.util.HashMap; +import net.minecraft.item.ItemStack; + import java.util.LinkedList; import java.util.List; -import java.util.Map; - -import net.minecraft.item.ItemStack; public class AltarRecipeRegistry { public static List altarRecipes = new LinkedList(); - public static Map orbMap = new HashMap(); public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) { @@ -24,10 +21,6 @@ public class AltarRecipeRegistry public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) { - if(!orbMap.containsKey(minTier)) - { - orbMap.put(minTier, orbStack); - } registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true); } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java b/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java deleted file mode 100644 index 9f685d5..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/IFadedRune.java +++ /dev/null @@ -1,6 +0,0 @@ -package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; - -public interface IFadedRune -{ - public int getAltarTierLimit(int meta); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java deleted file mode 100644 index a05c700..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -package WayofTime.alchemicalWizardry.api.compress; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public abstract class CompressionHandler -{ - /** - * Called to look at the inventory and syphons the required stack. Returns resultant stack if successful, and null if not. - * @param inv The inventory iterated through - * @return The result of the compression - */ - public abstract ItemStack compressInventory(ItemStack[] inv, World world); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java deleted file mode 100644 index fd17c8b..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/compress/CompressionRegistry.java +++ /dev/null @@ -1,67 +0,0 @@ -package WayofTime.alchemicalWizardry.api.compress; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * A registry aimed to help compress items in an inventory into its compressible form. - * - */ -public class CompressionRegistry -{ - public static List compressionRegistry = new ArrayList(); - public static Map thresholdMap = new HashMap(); - - public static void registerHandler(CompressionHandler handler) - { - compressionRegistry.add(handler); - } - - /** - * Registers an item so that it only compresses while above this threshold - * @param stack - * @param threshold - */ - public static void registerItemThreshold(ItemStack stack, int threshold) - { - thresholdMap.put(stack, new Integer(threshold)); - } - - public static ItemStack compressInventory(ItemStack[] inv, World world) - { - for(CompressionHandler handler : compressionRegistry) - { - ItemStack stack = handler.compressInventory(inv, world); - if(stack != null) - { - return stack; - } - } - - return null; - } - - public static int getItemThreshold(ItemStack stack) - { - for(Entry entry : thresholdMap.entrySet()) - { - if(areItemStacksEqual(entry.getKey(), stack)) - { - return entry.getValue(); - } - } - - return 0; - } - - public static boolean areItemStacksEqual(ItemStack stack, ItemStack compressedStack) - { - return stack.isItemEqual(compressedStack) && (stack.getTagCompound() == null ? compressedStack.getTagCompound() == null : stack.getTagCompound().equals(compressedStack.getTagCompound())); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java index 95e15da..a0a9273 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java @@ -1,11 +1,9 @@ package WayofTime.alchemicalWizardry.api.event; -import cpw.mods.fml.common.eventhandler.Cancelable; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import cpw.mods.fml.common.eventhandler.Event; -@Cancelable public class ItemBindEvent extends Event { public final EntityPlayer player; diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java deleted file mode 100644 index 5a81c1d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainInContainerEvent.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class ItemDrainInContainerEvent extends SoulNetworkEvent -{ - public ItemStack stack; - public ItemDrainInContainerEvent(ItemStack stack, String ownerNetwork, int drainAmount) - { - super(ownerNetwork, drainAmount); - this.stack = stack; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java deleted file mode 100644 index 40c3170..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/TeleposeEvent.java +++ /dev/null @@ -1,56 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.block.Block; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; - -/** Fired when a teleposer attempts to transpose two blocks. Use this to perform special cleanup or compensation, -or cancel it entirely to prevent the transposition. */ -@Cancelable -public class TeleposeEvent extends Event { - - public final World initialWorld; - public final int initialX; - public final int initialY; - public final int initialZ; - - public final Block initialBlock; - public final int initialMetadata; - - public final World finalWorld; - public final int finalX; - public final int finalY; - public final int finalZ; - - public final Block finalBlock; - public final int finalMetadata; - - public TeleposeEvent(World wi, int xi, int yi, int zi, Block bi, int mi, World wf, int xf, int yf, int zf, Block bf, int mf) { - initialWorld = wi; - initialX = xi; - initialY = yi; - initialZ = zi; - - initialBlock = bi; - initialMetadata = mi; - - finalWorld = wf; - finalX = xf; - finalY = yf; - finalZ = zf; - - finalBlock = bf; - finalMetadata = mf; - } - - public TileEntity getInitialTile() { - return initialWorld.getTileEntity(initialX, initialY, initialZ); - } - - public TileEntity getFinalTile() { - return finalWorld.getTileEntity(finalX, finalY, finalZ); - } - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java index 93ed96f..72f0c83 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java @@ -392,11 +392,11 @@ public class ItemSpellMultiTool extends Item { par3List.add("A mace filled with ancient alchemy"); - if (!(par1ItemStack.getTagCompound() == null)) + if (!(par1ItemStack.stackTagCompound == null)) { - if (!par1ItemStack.getTagCompound().getString("ownerName").equals("")) + if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) { - par3List.add("Current owner: " + par1ItemStack.getTagCompound().getString("ownerName")); + par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); } for (String str : this.getToolListString(par1ItemStack)) @@ -479,7 +479,7 @@ public class ItemSpellMultiTool extends Item tag.setFloat("itemAttack", Math.max(damage, 0.0f)); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } else { stack.setTagCompound(new NBTTagCompound()); @@ -488,7 +488,7 @@ public class ItemSpellMultiTool extends Item tag.setFloat("itemAttack", Math.max(damage, 0.0f)); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } } @@ -655,7 +655,7 @@ public class ItemSpellMultiTool extends Item tag.setBoolean("silkTouch", silkTouch); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } else { stack.setTagCompound(new NBTTagCompound()); @@ -664,7 +664,7 @@ public class ItemSpellMultiTool extends Item tag.setBoolean("silkTouch", silkTouch); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } } @@ -691,7 +691,7 @@ public class ItemSpellMultiTool extends Item tag.setInteger("fortuneLevel", Math.max(fortune, 0)); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } else { stack.setTagCompound(new NBTTagCompound()); @@ -700,7 +700,7 @@ public class ItemSpellMultiTool extends Item tag.setInteger("fortuneLevel", Math.max(fortune, 0)); - stack.getTagCompound().setTag(tagName, tag); + stack.stackTagCompound.setTag(tagName, tag); } } @@ -776,7 +776,7 @@ public class ItemSpellMultiTool extends Item tag.setFloat("critChance", Math.max(chance, 0)); - container.getTagCompound().setTag(tagName, tag); + container.stackTagCompound.setTag(tagName, tag); } else { container.setTagCompound(new NBTTagCompound()); @@ -785,7 +785,7 @@ public class ItemSpellMultiTool extends Item tag.setFloat("critChance", Math.max(chance, 0)); - container.getTagCompound().setTag(tagName, tag); + container.stackTagCompound.setTag(tagName, tag); } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java index 86bbb56..3b22ded 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java @@ -39,17 +39,12 @@ public class ShapelessBloodOrbRecipe implements IRecipe output = result.copy(); for (Object in : recipe) { - if (in instanceof IBloodOrb) + if (in instanceof ItemStack) + { + input.add(((ItemStack) in).copy()); + } else if (in instanceof IBloodOrb) { //If the item is an instanceof IBloodOrb then save the level of the orb input.add((Integer) (((IBloodOrb) in).getOrbLevel())); - } - else if (in instanceof ItemStack) - { - if (((ItemStack)in).getItem() instanceof IBloodOrb) - { - input.add((Integer) (((IBloodOrb) ((ItemStack)in).getItem()).getOrbLevel())); - } - else input.add(((ItemStack) in).copy()); } else if (in instanceof Item) { input.add(new ItemStack((Item) in)); @@ -142,7 +137,6 @@ public class ShapelessBloodOrbRecipe implements IRecipe return false; } } else return false; - match = true; } else if (next instanceof ItemStack) { match = OreDictionary.itemMatches((ItemStack) next, slot, false); diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java deleted file mode 100644 index 7607023..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ILPGauge.java +++ /dev/null @@ -1,8 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -import net.minecraft.item.ItemStack; - -public interface ILPGauge -{ - public boolean canSeeLPBar(ItemStack itemStack); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java deleted file mode 100644 index 03094a8..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IRitualDiviner.java +++ /dev/null @@ -1,14 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -import net.minecraft.item.ItemStack; - -public interface IRitualDiviner { - int cycleDirection(ItemStack stack); - String getCurrentRitual(ItemStack stack); - int getDirection(ItemStack stack); - int getMaxRuneDisplacement(ItemStack stack); - String getNameForDirection(int direction); - void setCurrentRitual(ItemStack stack, String ritualID); - void setDirection(ItemStack stack, int direction); - void setMaxRuneDisplacement(ItemStack stack, int displacement); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java b/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java index 7eea34c..f898fc6 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java @@ -1,13 +1,13 @@ package WayofTime.alchemicalWizardry.api.renderer; +//import WayofTime.alchemicalWizardry.common.tileEntity.TEMasterStone; import net.minecraft.client.renderer.texture.TextureManager; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.ResourceLocation; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; public abstract class MRSRenderer { - public abstract void renderAt(IMasterRitualStone tile, double x, double y, double z); + //public abstract void renderAt(TEMasterStone tile, double x, double y, double z); protected void bindTexture(ResourceLocation p_147499_1_) { diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java index 0866677..e00ed79 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java @@ -33,12 +33,4 @@ public interface IMasterRitualStone extends ISegmentedReagentHandler public NBTTagCompound getCustomRitualTag(); public void setCustomRitualTag(NBTTagCompound tag); - - public boolean areTanksEmpty(); - - public int getRunningTime(); - - public LocalRitualStorage getLocalStorage(); - - public void setLocalStorage(LocalRitualStorage storage); } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java index c2cec51..efe32e0 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java @@ -4,15 +4,5 @@ import net.minecraft.world.World; public interface IRitualStone { - /** - * x, y, and z give the position of the Ritual Stone - * @param world - * @param x - * @param y - * @param z - * @param meta - * @param runeType - * @return - */ - public boolean isRuneType(World world, int x, int y, int z, int meta, int runeType); + public int getRuneType(World world, int x, int y, int z, int meta); } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java deleted file mode 100644 index 7204515..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/ITileRitualStone.java +++ /dev/null @@ -1,6 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -public interface ITileRitualStone -{ - public boolean isRuneType(int runeType); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java deleted file mode 100644 index e5a3241..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/LocalRitualStorage.java +++ /dev/null @@ -1,42 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -import net.minecraft.nbt.NBTTagCompound; -import WayofTime.alchemicalWizardry.api.Int3; - -/** - * This class is used to pass ritual-specific data into the RitualEffect from the containing Master Ritual Stone. This is basically used as auxillarary storage, - * for when simply storing to NBT becomes... difficult. - * - */ -public class LocalRitualStorage -{ - public int xCoord; - public int yCoord; - public int zCoord; - - public void writeToNBT(NBTTagCompound tag) - { - tag.setInteger("xCoord", xCoord); - tag.setInteger("yCoord", yCoord); - tag.setInteger("zCoord", zCoord); - } - - public void readFromNBT(NBTTagCompound tag) - { - this.xCoord = tag.getInteger("xCoord"); - this.yCoord = tag.getInteger("yCoord"); - this.zCoord = tag.getInteger("zCoord"); - } - - public Int3 getLocation() - { - return new Int3(xCoord, yCoord, zCoord); - } - - public void setLocation(Int3 location) - { - this.xCoord = location.xCoord; - this.yCoord = location.yCoord; - this.zCoord = location.zCoord; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java index 85f291c..498c803 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java @@ -1,6 +1,5 @@ package WayofTime.alchemicalWizardry.api.rituals; -import java.util.ArrayList; import java.util.List; import net.minecraft.entity.player.EntityPlayer; @@ -54,37 +53,4 @@ public abstract class RitualEffect return false; } - - public LocalRitualStorage getNewLocalStorage() - { - return new LocalRitualStorage(); - } - - public void addOffsetRunes(ArrayList ritualList, int off1, int off2, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, off2, rune)); - ritualList.add(new RitualComponent(off2, y, off1, rune)); - ritualList.add(new RitualComponent(off1, y, -off2, rune)); - ritualList.add(new RitualComponent(-off2, y, off1, rune)); - ritualList.add(new RitualComponent(-off1, y, off2, rune)); - ritualList.add(new RitualComponent(off2, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, -off2, rune)); - ritualList.add(new RitualComponent(-off2, y, -off1, rune)); - } - - public void addCornerRunes(ArrayList ritualList, int off1, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, off1, rune)); - ritualList.add(new RitualComponent(off1, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, -off1, rune)); - ritualList.add(new RitualComponent(-off1, y, off1, rune)); - } - - public void addParallelRunes(ArrayList ritualList, int off1, int y, int rune) - { - ritualList.add(new RitualComponent(off1, y, 0, rune)); - ritualList.add(new RitualComponent(-off1, y, 0, rune)); - ritualList.add(new RitualComponent(0, y, -off1, rune)); - ritualList.add(new RitualComponent(0, y, off1, rune)); - } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java index a4d4f66..b3bd97f 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java @@ -7,7 +7,6 @@ import java.util.Map; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import WayofTime.alchemicalWizardry.api.event.RitualRunEvent; @@ -17,12 +16,12 @@ import cpw.mods.fml.common.eventhandler.Event; public class Rituals { - public final int crystalLevel; - public final int actCost; - public final RitualEffect effect; - public final String name; + private int crystalLevel; + private int actCost; + private RitualEffect effect; + private String name; - public final MRSRenderer customRenderer; + private MRSRenderer customRenderer; public static Map ritualMap = new HashMap(); public static List keyList = new LinkedList(); @@ -150,21 +149,83 @@ public class Rituals } Block test = null; - TileEntity te = null; - for (RitualComponent rc : ritual) + switch (direction) { - test = world.getBlock(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); - te = world.getTileEntity(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)); + case 1: + for (RitualComponent rc : ritual) + { + test = world.getBlock(x + rc.getX(), y + rc.getY(), z + rc.getZ()); - if (!(test instanceof IRitualStone && ((IRitualStone)test).isRuneType(world, x + rc.getX(direction), y, z+ rc.getZ(direction), world.getBlockMetadata(x + rc.getX(direction), y + rc.getY(), z + rc.getZ(direction)), rc.getStoneType())) - && !(te instanceof ITileRitualStone && ((ITileRitualStone)te).isRuneType(rc.getStoneType()))) - { - return false; - } + if (!(test instanceof IRitualStone)) + { + return false; + } + + if (((IRitualStone)test).getRuneType(world, x, y, z, world.getBlockMetadata(x + rc.getX(), y + rc.getY(), z + rc.getZ())) != rc.getStoneType()) + { + return false; + } + } + + return true; + + case 2: + for (RitualComponent rc : ritual) + { + test = world.getBlock(x - rc.getZ(), y + rc.getY(), z + rc.getX()); + + if (!(test instanceof IRitualStone)) + { + return false; + } + + if (((IRitualStone)test).getRuneType(world, x, y, z, world.getBlockMetadata(x - rc.getZ(), y + rc.getY(), z + rc.getX())) != rc.getStoneType()) + { + return false; + } + } + + return true; + + case 3: + for (RitualComponent rc : ritual) + { + test = world.getBlock(x - rc.getX(), y + rc.getY(), z - rc.getZ()); + + if (!(test instanceof IRitualStone)) + { + return false; + } + + if (((IRitualStone)test).getRuneType(world, x, y, z, world.getBlockMetadata(x - rc.getX(), y + rc.getY(), z - rc.getZ())) != rc.getStoneType()) + { + return false; + } + } + + return true; + + case 4: + for (RitualComponent rc : ritual) + { + test = world.getBlock(x + rc.getZ(), y + rc.getY(), z - rc.getX()); + + if (!(test instanceof IRitualStone)) + { + return false; + } + + if (((IRitualStone)test).getRuneType(world, x, y, z, world.getBlockMetadata(x + rc.getZ(), y + rc.getY(), z - rc.getX())) != rc.getStoneType()) + { + return false; + } + } + + return true; } - return true; + return false; } public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID) @@ -289,7 +350,9 @@ public class Rituals { ritual.effect.onRitualBroken(ritualStone, method); } - } + } + + System.out.println(method); } public static int getNumberOfRituals() @@ -374,22 +437,4 @@ public class Rituals return null; } - - public static LocalRitualStorage getLocalStorage(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { - RitualEffect eff = ritual.effect; - if(eff != null) - { - return eff.getNewLocalStorage(); - } - } - } - - return null; - } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java deleted file mode 100644 index c9b6931..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/ComplexNetworkHandler.java +++ /dev/null @@ -1,126 +0,0 @@ -package WayofTime.alchemicalWizardry.api.soulNetwork; - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileNotFoundException; -import java.io.FileReader; -import java.io.FileWriter; -import java.io.IOException; -import java.io.Writer; -import java.util.HashMap; -import java.util.Map.Entry; -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.server.MinecraftServer; - -import com.google.gson.Gson; -import com.google.gson.GsonBuilder; -import com.mojang.authlib.GameProfile; - - -/** - * Temporary class to hash-out how to create a network not completely tied to the player. - */ -public class ComplexNetworkHandler -{ - public static String fileName = "config/BloodMagic/soulnetworkKeys"; - static HashMap keyMap = new HashMap(); - public static UUID getUUIDFromPlayer(EntityPlayer player) - { - return player.getPersistentID(); - } - - public static EntityPlayer getPlayerFromUUID(UUID uuid) - { - MinecraftServer server = MinecraftServer.getServer(); - GameProfile gameProfile; - gameProfile = server.func_152358_ax().func_152652_a(uuid); - String str = uuid.toString(); - //TODO ServerConfigurationManager d.createPlayerForUser - UUID.fromString(str); - return null; - } - - public static String getKeyForPlayer(EntityPlayer player) - { - return ""; - } - - public static UUID getUUIDForKey(String key) - { -// if (MinecraftServer.getServer() == null) -// { -// return null; -// } -// -// World world = MinecraftServer.getServer().worldServers[0]; -// UUIDKeyMap data = (UUIDKeyMap) world.loadItemData(UUIDKeyMap.class, key); -// -// if (data == null) -// { -// data = new UUIDKeyMap(key); -// world.setItemData(key, data); -// } - return null; - } - - public static String assignKeyToPlayer(EntityPlayer player) - { - return ""; - } - - public static void save() - { - keyMap.put(new UUID(0, 0), "test"); - - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - String json = gson.toJson(keyMap); - Writer writer; - try - { - writer = new FileWriter(fileName + ".json"); - writer.write(json); - writer.close(); - } catch (IOException e) - { - e.printStackTrace(); - } - } - - public static void load() - { - File save = new File(fileName + ".json"); - - if(save.canRead()) - { - Gson gson = new GsonBuilder().setPrettyPrinting().create(); - - BufferedReader br; - - try - { - br = new BufferedReader(new FileReader(save)); - HashMap schema = gson.fromJson(br, keyMap.getClass()); - - keyMap = schema; - - if(keyMap != null) - { - for(Entry entry : keyMap.entrySet()) - { - System.out.println("" + entry.getValue() + " gave: "+ entry.getKey()); - } - } - } catch (FileNotFoundException e) - { - e.printStackTrace(); - } - } - - else - { - keyMap = null; - } - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java b/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java index 91bcdaf..61d24ee 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java @@ -5,26 +5,22 @@ import net.minecraft.nbt.NBTTagCompound; public class LifeEssenceNetwork extends net.minecraft.world.WorldSavedData { public int currentEssence; - public int maxOrb; public LifeEssenceNetwork(String par1Str) { super(par1Str); currentEssence = 0; - maxOrb = 0; } @Override public void readFromNBT(NBTTagCompound nbttagcompound) { currentEssence = nbttagcompound.getInteger("currentEssence"); - maxOrb = nbttagcompound.getInteger("maxOrb"); } @Override public void writeToNBT(NBTTagCompound nbttagcompound) { nbttagcompound.setInteger("currentEssence", currentEssence); - nbttagcompound.setInteger("maxOrb", maxOrb); } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java index 883c521..ce900aa 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java @@ -13,13 +13,11 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import WayofTime.alchemicalWizardry.api.event.AddToNetworkEvent; import WayofTime.alchemicalWizardry.api.event.ItemBindEvent; -import WayofTime.alchemicalWizardry.api.event.ItemDrainInContainerEvent; import WayofTime.alchemicalWizardry.api.event.ItemDrainNetworkEvent; import com.mojang.authlib.GameProfile; import cpw.mods.fml.common.eventhandler.Event; -import cpw.mods.fml.common.eventhandler.Event.Result; public class SoulNetworkHandler { @@ -35,84 +33,6 @@ public class SoulNetworkHandler gameProfile = server.func_152358_ax().func_152652_a(uuid); return null; } - - public static boolean syphonFromNetworkWhileInContainer(ItemStack ist, int damageToBeDone) - { - String ownerName = ""; - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { - ownerName = ist.getTagCompound().getString("ownerName"); - } - - ItemDrainInContainerEvent event = new ItemDrainInContainerEvent(ist, ownerName, damageToBeDone); - - if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Result.DENY) - { - return false; - } - - return syphonFromNetwork(event.ownerNetwork, event.drainAmount) >= damageToBeDone; - } - - public static int getCurrentMaxOrb(String ownerName) - { - if (MinecraftServer.getServer() == null) - { - return 0; - } - - World world = MinecraftServer.getServer().worldServers[0]; - LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - - if (data == null) - { - data = new LifeEssenceNetwork(ownerName); - world.setItemData(ownerName, data); - } - - return data.maxOrb; - } - - public static void setMaxOrbToMax(String ownerName, int maxOrb) - { - if (MinecraftServer.getServer() == null) - { - return; - } - - World world = MinecraftServer.getServer().worldServers[0]; - LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, ownerName); - - if (data == null) - { - data = new LifeEssenceNetwork(ownerName); - world.setItemData(ownerName, data); - } - - data.maxOrb = Math.max(maxOrb, data.maxOrb); - data.markDirty(); - } - - public static int getMaximumForOrbTier(int maxOrb) - { - switch(maxOrb) - { - case 1: - return 5000; - case 2: - return 25000; - case 3: - return 150000; - case 4: - return 1000000; - case 5: - return 10000000; - case 6: - return 30000000; - default: - return 1; - } - } public static int syphonFromNetwork(ItemStack ist, int damageToBeDone) { @@ -379,34 +299,34 @@ public class SoulNetworkHandler } } - public static boolean checkAndSetItemOwner(ItemStack item, EntityPlayer player) + public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player) { - if (item.hasTagCompound() && !item.getTagCompound().getString("ownerName").equals("")) return true; - - ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item); - - if(!MinecraftForge.EVENT_BUS.post(event)) - { - if (!item.hasTagCompound()) - { - item.setTagCompound(new NBTTagCompound()); - } - item.getTagCompound().setString("ownerName", event.key); - return true; - } - return false; - } - - public static void checkAndSetItemOwner(ItemStack item, String ownerName) - { - if (item.getTagCompound() == null) + if (item.stackTagCompound == null) { item.setTagCompound(new NBTTagCompound()); } - if (item.getTagCompound().getString("ownerName").equals("")) + if (item.stackTagCompound.getString("ownerName").equals("")) { - item.getTagCompound().setString("ownerName", ownerName); + ItemBindEvent event = new ItemBindEvent(player, SoulNetworkHandler.getUsername(player), item); + + if(!MinecraftForge.EVENT_BUS.post(event)) + { + item.stackTagCompound.setString("ownerName", event.key); + } + } + } + + public static void checkAndSetItemOwner(ItemStack item, String ownerName) + { + if (item.stackTagCompound == null) + { + item.setTagCompound(new NBTTagCompound()); + } + + if (item.stackTagCompound.getString("ownerName").equals("")) + { + item.stackTagCompound.setString("ownerName", ownerName); } } @@ -448,11 +368,11 @@ public class SoulNetworkHandler public static String getOwnerName(ItemStack item) { - if (item.getTagCompound() == null) + if (item.stackTagCompound == null) { item.setTagCompound(new NBTTagCompound()); } - return item.getTagCompound().getString("ownerName"); + return item.stackTagCompound.getString("ownerName"); } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java index bab2963..a0cc0a5 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java @@ -8,162 +8,14 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.CraftingManager; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.MathHelper; import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.Vec3; import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentRegistry; -import cpw.mods.fml.common.registry.GameRegistry; public class APISpellHelper { - /** - * Thanks Kihira! <3 - * @param player - * @return persistent data tag - */ - private static NBTTagCompound getPersistentDataTag(EntityPlayer player) - { - NBTTagCompound forgeData = player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG); - NBTTagCompound beaconData = forgeData.getCompoundTag("BloodMagic"); - - //Creates/sets the tags if they don't exist - if (!forgeData.hasKey("BloodMagic")) forgeData.setTag("BloodMagic", beaconData); - if (!player.getEntityData().hasKey(EntityPlayer.PERSISTED_NBT_TAG)) player.getEntityData().setTag(EntityPlayer.PERSISTED_NBT_TAG, forgeData); - - return beaconData; - } - - public static int getPlayerLPTag(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:StoredLP")) - { - return data.getInteger("BM:StoredLP"); - } - - return 0; - } - - public static void setPlayerLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setInteger("BM:StoredLP", amount); - } - - public static int getPlayerMaxLPTag(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:MaxStoredLP")) - { - return data.getInteger("BM:MaxStoredLP"); - } - - return 0; - } - - public static void setPlayerMaxLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setInteger("BM:MaxStoredLP", amount); - } - - public static float getPlayerCurrentReagentAmount(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:StoredReagentAmount")) - { - return data.getFloat("BM:StoredReagentAmount"); - } - - return 0; - } - - public static void setPlayerCurrentReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setFloat("BM:StoredReagentAmount", amount); - } - - public static float getPlayerMaxReagentAmount(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:MaxReagentAmount")) - { - return data.getFloat("BM:MaxReagentAmount"); - } - - return 0; - } - - public static void setPlayerMaxReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setFloat("BM:MaxReagentAmount", amount); - } - - public static Reagent getPlayerReagentType(EntityPlayer player) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - if(data.hasKey("BM:ReagentType")) - { - return ReagentRegistry.getReagentForKey(data.getString("BM:ReagentType")); - } - - return null; - } - - public static void setPlayerReagentType(EntityPlayer player, String str) - { - NBTTagCompound data = APISpellHelper.getPersistentDataTag(player); - data.setString("BM:ReagentType", str); - } - - public static void setPlayerReagentType(EntityPlayer player, Reagent reagent) - { - setPlayerReagentType(player, ReagentRegistry.getKeyForReagent(reagent)); - } - - public static float getCurrentAdditionalHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:CurrentAddedHP")) - { - return data.getFloat("BM:CurrentAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalHP(EntityPlayer player, float amount) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:CurrentAddedHP", amount); - } - - public static float getCurrentAdditionalMaxHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:MaxAddedHP")) - { - return data.getFloat("BM:MaxAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalMaxHP(EntityPlayer player, float maxHP) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:MaxAddedHP", maxHP); - } - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) { float f = 1.0F; @@ -174,7 +26,7 @@ public class APISpellHelper if (!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D; double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; - Vec3 vec3 = APISpellHelper.createVec3(d0, d1, d2); + Vec3 vec3 = Vec3.createVectorHelper(d0, d1, d2); float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI); float f4 = MathHelper.sin(-f2 * 0.017453292F - (float) Math.PI); float f5 = -MathHelper.cos(-f1 * 0.017453292F); @@ -184,17 +36,12 @@ public class APISpellHelper double d3 = range; if (player instanceof EntityPlayerMP) { -// d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); + d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance(); } Vec3 vec31 = vec3.addVector((double) f7 * d3, (double) f6 * d3, (double) f8 * d3); return world.func_147447_a(vec3, vec31, par3, !par3, par3); } - public static Vec3 createVec3(double x, double y, double z) - { - return Vec3.createVectorHelper(x, y, z); - } - public static List getItemsFromBlock(World world, Block block, int x, int y, int z, int meta, boolean silkTouch, int fortune) { boolean canSilk = block.canSilkHarvest(world, null, x, y, z, meta); @@ -251,75 +98,4 @@ public class APISpellHelper return ""; } } - - public static Block getBlockForString(String str) - { - String[] parts = str.split(":"); - String modId = parts[0]; - String name = parts[1]; - return GameRegistry.findBlock(modId, name); - } - - public static Item getItemForString(String str) - { - String[] parts = str.split(":"); - String modId = parts[0]; - String name = parts[1]; - return GameRegistry.findItem(modId, name); - } - - public static ItemStack getItemStackForString(String str) - { - String[] parts = str.split(":"); - int meta = 0; - if(parts.length >= 3) - { - meta = Integer.decode(parts[2]); - }else if(parts.length < 2) - { - return null; - } - String modId = parts[0]; - String name = parts[1]; - - String itemString = modId + ":" + name; - Item item = APISpellHelper.getItemForString(itemString); - if(item != null) - { - return new ItemStack(item, 1, meta); - } - - Block block = APISpellHelper.getBlockForString(itemString); - if(block != null) - { - return new ItemStack(block, 1, meta); - } - - return null; - } - - public static IRecipe getRecipeForItemStack(ItemStack reqStack) //Does not match NBT. Durrr! -smack- - { - if(reqStack == null) - { - return null; //Why are you even doing this to yourself!? You know this can't be healthy! - } - List craftingList = CraftingManager.getInstance().getRecipeList(); - for(Object posRecipe : craftingList) - { - if(posRecipe instanceof IRecipe) - { - ItemStack outputStack = ((IRecipe) posRecipe).getRecipeOutput(); - if(outputStack != null) - { - if(outputStack.getItem() == reqStack.getItem() && (outputStack.getItem().getHasSubtypes() ? outputStack.getItemDamage() == reqStack.getItemDamage() : true)) - { - return (IRecipe)posRecipe; - } - } - } - } - - return null; - } } diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java index d6ed998..becdb32 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java @@ -1,25 +1,21 @@ package WayofTime.alchemicalWizardry.api.spell; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.block.Block; import net.minecraft.entity.Entity; import net.minecraft.entity.IProjectile; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MathHelper; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.*; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants; -import cpw.mods.fml.relauncher.Side; -import cpw.mods.fml.relauncher.SideOnly; + +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; public class EntitySpellProjectile extends Entity implements IProjectile { @@ -189,7 +185,7 @@ public class EntitySpellProjectile extends Entity implements IProjectile var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - if (var2 != null && var2.isVecInside(APISpellHelper.createVec3(posX, posY, posZ))) + if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) { inGround = true; } @@ -218,15 +214,15 @@ public class EntitySpellProjectile extends Entity implements IProjectile } } - Vec3 var17 = APISpellHelper.createVec3(posX, posY, posZ); - Vec3 var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); + Vec3 var17 = Vec3.createVectorHelper(posX, posY, posZ); + Vec3 var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); MovingObjectPosition var4 = worldObj.func_147447_a(var17, var3, true, false, false); - var17 = APISpellHelper.createVec3(posX, posY, posZ); - var3 = APISpellHelper.createVec3(posX + motionX, posY + motionY, posZ + motionZ); + var17 = Vec3.createVectorHelper(posX, posY, posZ); + var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); if (var4 != null) { - var3 = APISpellHelper.createVec3(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); + var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); } Entity var5 = null; diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java index f217b12..9d60722 100644 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java +++ b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java @@ -63,6 +63,8 @@ public class SpellEffectRegistry public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost) { + System.out.println("Debuging"); + if(paraClass == null || type == null || mod == null) { return null; @@ -145,9 +147,9 @@ public class SpellEffectRegistry public static void initiateRegistry() { SpellEffectRegistry.registerSpellType("FIRE", ComplexSpellType.FIRE); - SpellEffectRegistry.registerSpellType("ICE", ComplexSpellType.ICE); + SpellEffectRegistry.registerSpellType("WATER", ComplexSpellType.ICE); SpellEffectRegistry.registerSpellType("EARTH", ComplexSpellType.EARTH); - SpellEffectRegistry.registerSpellType("WIND", ComplexSpellType.WIND); + SpellEffectRegistry.registerSpellType("AIR", ComplexSpellType.WIND); SpellEffectRegistry.registerSpellModifier("DEFAULT", ComplexSpellModifier.DEFAULT); SpellEffectRegistry.registerSpellModifier("OFFENSIVE", ComplexSpellModifier.OFFENSIVE);