diff --git a/libs/PneumaticCraft-1.7.10-1.5.2-50-userdev.jar b/libs/PneumaticCraft-1.7.10-1.5.2-50-userdev.jar deleted file mode 100644 index cf7d705..0000000 Binary files a/libs/PneumaticCraft-1.7.10-1.5.2-50-userdev.jar and /dev/null differ diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java b/src/api/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java deleted file mode 100644 index d34dd41..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/ColourAndCoords.java +++ /dev/null @@ -1,45 +0,0 @@ -package WayofTime.alchemicalWizardry.api; - -import net.minecraft.nbt.NBTTagCompound; - -public class ColourAndCoords -{ - public int colourRed; - public int colourGreen; - public int colourBlue; - public int colourIntensity; - - public int xCoord; - public int yCoord; - public int zCoord; - - public ColourAndCoords(int red, int green, int blue, int intensity, int x, int y, int z) - { - this.colourRed = red; - this.colourGreen = green; - this.colourBlue = blue; - this.colourIntensity = intensity; - - this.xCoord = x; - this.yCoord = y; - this.zCoord = z; - } - - public static ColourAndCoords readFromNBT(NBTTagCompound tag) - { - return new ColourAndCoords(tag.getInteger("colourRed"), tag.getInteger("colourGreen"), tag.getInteger("colourBlue"), tag.getInteger("colourIntensity"), tag.getInteger("xCoord"), tag.getInteger("yCoord"), tag.getInteger("zCoord")); - } - - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { - tag.setInteger("colourRed", colourRed); - tag.setInteger("colourGreen", colourGreen); - tag.setInteger("colourBlue", colourBlue); - tag.setInteger("colourIntensity", colourIntensity); - tag.setInteger("xCoord", xCoord); - tag.setInteger("yCoord", yCoord); - tag.setInteger("zCoord", zCoord); - - return tag; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java deleted file mode 100644 index 6af0491..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemicalPotionCreationHandler.java +++ /dev/null @@ -1,79 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy; - -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; - -public class AlchemicalPotionCreationHandler -{ - public static ArrayList registeredPotionEffects = new ArrayList(); - - public static void addPotion(ItemStack itemStack, int potionID, int tickDuration) - { - registeredPotionEffects.add(new AlchemyPotionHandlerComponent(itemStack, potionID, tickDuration)); - } - - public static int getPotionIDForStack(ItemStack itemStack) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(itemStack)) - { - return aphc.getPotionID(); - } - } - - return -1; - } - - public static int getPotionTickDurationForStack(ItemStack itemStack) - { - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(itemStack)) - { - return aphc.getTickDuration(); - } - } - - return -1; - } - } - - public static boolean containsRegisteredPotionIngredient(ItemStack[] stackList) - { - for (ItemStack is : stackList) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(is)) - { - return true; - } - } - } - - return false; - } - - public static int getRegisteredPotionIngredientPosition(ItemStack[] stackList) - { - int i = 0; - - for (ItemStack is : stackList) - { - for (AlchemyPotionHandlerComponent aphc : registeredPotionEffects) - { - if (aphc.compareItemStack(is)) - { - return i; - } - } - - i++; - } - - return -1; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java deleted file mode 100644 index 6f0d461..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHandlerComponent.java +++ /dev/null @@ -1,52 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy; - -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; - -public class AlchemyPotionHandlerComponent -{ - private ItemStack itemStack; - private int potionID; - private int tickDuration; - - public AlchemyPotionHandlerComponent(ItemStack itemStack, int potionID, int tickDuration) - { - this.itemStack = itemStack; - this.potionID = potionID; - this.tickDuration = tickDuration; - } - - public boolean compareItemStack(ItemStack comparedStack) - { - if (comparedStack != null && itemStack != null) - { - if (comparedStack.getItem() instanceof ItemBlock) - { - if (itemStack.getItem() instanceof ItemBlock) - { - return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage(); - } - } else if (!(itemStack.getItem() instanceof ItemBlock)) - { - return comparedStack.getItem().equals(itemStack.getItem()) && comparedStack.getItemDamage() == itemStack.getItemDamage(); - } - } - - return false; - } - - public ItemStack getItemStack() - { - return itemStack; - } - - public int getPotionID() - { - return this.potionID; - } - - public int getTickDuration() - { - return this.tickDuration; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java deleted file mode 100644 index d346255..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyPotionHelper.java +++ /dev/null @@ -1,76 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; - -public class AlchemyPotionHelper -{ - private int potionID; - private int tickDuration; - private int concentration; - private int durationFactor; - - public AlchemyPotionHelper(int potionID, int tickDuration, int concentration, int durationFactor) - { - this.potionID = potionID; - this.tickDuration = tickDuration; - this.concentration = concentration; - this.durationFactor = durationFactor; - } - - public void setConcentration(int concentration) - { - this.concentration = concentration; - } - - public void setDurationFactor(int durationFactor) - { - this.durationFactor = durationFactor; - } - - public int getPotionID() - { - return this.potionID; - } - - public int getTickDuration() - { - return this.tickDuration; - } - - public int getConcentration() - { - return this.concentration; - } - - public int getdurationFactor() - { - return this.durationFactor; - } - - public PotionEffect getPotionEffect() - { - if (potionID == Potion.heal.id || potionID == Potion.harm.id) - { - return (new PotionEffect(potionID, 1, concentration)); - } - - return (new PotionEffect(potionID, (int) (tickDuration * Math.pow(0.5f, concentration) * Math.pow(8.0f / 3.0f, durationFactor)), concentration)); - } - - public static AlchemyPotionHelper readEffectFromNBT(NBTTagCompound tagCompound) - { - return new AlchemyPotionHelper(tagCompound.getInteger("potionID"), tagCompound.getInteger("tickDuration"), tagCompound.getInteger("concentration"), tagCompound.getInteger("durationFactor")); - } - - public static NBTTagCompound setEffectToNBT(AlchemyPotionHelper aph) - { - NBTTagCompound tagCompound = new NBTTagCompound(); - tagCompound.setInteger("potionID", aph.getPotionID()); - tagCompound.setInteger("tickDuration", aph.getTickDuration()); - tagCompound.setInteger("concentration", aph.getConcentration()); - tagCompound.setInteger("durationFactor", aph.getdurationFactor()); - return tagCompound; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java deleted file mode 100644 index aad27ee..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipe.java +++ /dev/null @@ -1,143 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy; - -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraftforge.oredict.OreDictionary; - -public class AlchemyRecipe -{ - private ItemStack output; - private ItemStack[] recipe; - private int bloodOrbLevel; - private int amountNeeded; - - public AlchemyRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) - { - this.output = output; - this.recipe = recipe; - this.amountNeeded = amountNeeded; - this.bloodOrbLevel = bloodOrbLevel; - } - - public boolean doesRecipeMatch(ItemStack[] items, int slottedBloodOrbLevel) - { - if (slottedBloodOrbLevel < bloodOrbLevel) - { - return false; - } - - ItemStack[] recipe = new ItemStack[5]; - - if (items.length < 5) - { - return false; - } - - if (this.recipe.length != 5) - { - ItemStack[] newRecipe = new ItemStack[5]; - - for (int i = 0; i < 5; i++) - { - if (i + 1 > this.recipe.length) - { - newRecipe[i] = null; - } else - { - newRecipe[i] = this.recipe[i]; - } - } - - recipe = newRecipe; - } else - { - recipe = this.recipe; - } - - boolean[] checkList = new boolean[5]; - - for (int i = 0; i < 5; i++) - { - checkList[i] = false; - } - - for (int i = 0; i < 5; i++) - { - ItemStack recipeItemStack = recipe[i]; - - if (recipeItemStack == null) - { - continue; - } - - boolean test = false; - - for (int j = 0; j < 5; j++) - { - if (checkList[j]) - { - continue; - } - - ItemStack checkedItemStack = items[j]; - - if (checkedItemStack == null) - { - continue; - } - - boolean quickTest = false; - - if (recipeItemStack.getItem() instanceof ItemBlock) - { - if (checkedItemStack.getItem() instanceof ItemBlock) - { - quickTest = true; - } - } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) - { - quickTest = true; - } - - if (!quickTest) - { - continue; - } - - if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem()) - { - test = true; - checkList[j] = true; - break; - } - } - - if (!test) - { - return false; - } - } - - return true; - } - - public ItemStack getResult() - { - return output.copy(); - } - - public int getAmountNeeded() - { - return this.amountNeeded; - } - - public ItemStack[] getRecipe() - { - return this.recipe; - } - - public int getOrbLevel() - { - return this.bloodOrbLevel; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java deleted file mode 100644 index dfb2459..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/AlchemyRecipeRegistry.java +++ /dev/null @@ -1,85 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy; - -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import net.minecraft.item.ItemStack; - -import java.util.ArrayList; -import java.util.List; - -public class AlchemyRecipeRegistry -{ - public static List recipes = new ArrayList(); - - public static void registerRecipe(ItemStack output, int amountNeeded, ItemStack[] recipe, int bloodOrbLevel) - { - recipes.add(new AlchemyRecipe(output, amountNeeded, recipe, bloodOrbLevel)); - } - - public static ItemStack getResult(ItemStack[] recipe, ItemStack bloodOrb) - { - if (bloodOrb == null) - { - return null; - } - - if (!(bloodOrb.getItem() instanceof IBloodOrb)) - { - return null; - } - - int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel(); - - for (AlchemyRecipe ar : recipes) - { - if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) - { - return (ar.getResult()); - } - } - - return null; - } - - public static int getAmountNeeded(ItemStack[] recipe, ItemStack bloodOrb) - { - if (bloodOrb == null) - { - return 0; - } - - if (!(bloodOrb.getItem() instanceof IBloodOrb)) - { - return 0; - } - - int bloodOrbLevel = ((IBloodOrb) bloodOrb.getItem()).getOrbLevel(); - - for (AlchemyRecipe ar : recipes) - { - if (ar.doesRecipeMatch(recipe, bloodOrbLevel)) - { - return (ar.getAmountNeeded()); - } - } - - return 0; - } - - public static ItemStack[] getRecipeForItemStack(ItemStack itemStack) - { - for (AlchemyRecipe ar : recipes) - { - ItemStack result = ar.getResult(); - - if (result != null) - { - if (result.isItemEqual(itemStack)) - { - return ar.getRecipe(); - } - } - } - - return null; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java deleted file mode 100644 index 8b3e227..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IAlchemyGoggles.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IAlchemyGoggles -{ - public boolean showIngameHUD(World world, ItemStack stack, EntityPlayer player); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java deleted file mode 100644 index 804fa72..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentContainer.java +++ /dev/null @@ -1,16 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -public interface IReagentContainer -{ - public ReagentStack getReagent(); - - public int getReagentStackAmount(); - - public int getCapacity(); - - public int fill(ReagentStack resource, boolean doFill); - - public ReagentStack drain(int maxDrain, boolean doDrain); - - public ReagentContainerInfo getInfo(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java deleted file mode 100644 index 165e9ab..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/IReagentHandler.java +++ /dev/null @@ -1,18 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraftforge.common.util.ForgeDirection; - -public interface IReagentHandler -{ - int fill(ForgeDirection from, ReagentStack resource, boolean doFill); - - ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain); - - ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain); - - boolean canFill(ForgeDirection from, Reagent reagent); - - boolean canDrain(ForgeDirection from, Reagent reagent); - - ReagentContainerInfo[] getContainerInfo(ForgeDirection from); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java deleted file mode 100644 index 14cb51c..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ISegmentedReagentHandler.java +++ /dev/null @@ -1,14 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import java.util.Map; - -public interface ISegmentedReagentHandler extends IReagentHandler -{ - public int getNumberOfTanks(); - - public int getTanksTunedToReagent(Reagent reagent); - - public void setTanksTunedToReagent(Reagent reagent, int total); - - public Map getAttunedTankMap(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java deleted file mode 100644 index 1abbc0b..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/Reagent.java +++ /dev/null @@ -1,52 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -public class Reagent -{ - public final String name; - - public static final int REAGENT_SIZE = 1000; - - private int colourRed = 0; - private int colourGreen = 0; - private int colourBlue = 0; - private int colourIntensity = 255; - - public Reagent(String name) - { - this.name = name; - } - - public void setColour(int red, int green, int blue, int intensity) - { - this.colourRed = red; - this.colourGreen = green; - this.colourBlue = blue; - this.colourIntensity = intensity; - } - - public int getColourRed() - { - return colourRed; - } - - public int getColourGreen() - { - return colourGreen; - } - - public int getColourBlue() - { - return colourBlue; - } - - public int getColourIntensity() - { - return colourIntensity; - } - - @Override - public boolean equals(Object o) - { - return o instanceof Reagent ? this == o && name.equals(((Reagent) o).name) : false; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java deleted file mode 100644 index c135274..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainer.java +++ /dev/null @@ -1,153 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraft.nbt.NBTTagCompound; - -public class ReagentContainer implements IReagentContainer -{ - protected ReagentStack reagentStack; - protected int capacity; - - public ReagentContainer(int capacity) - { - this(null, capacity); - } - - public ReagentContainer(ReagentStack stack, int capacity) - { - this.reagentStack = stack; - this.capacity = capacity; - } - - public ReagentContainer(Reagent reagent, int amount, int capacity) - { - this(new ReagentStack(reagent, amount), capacity); - } - - public static ReagentContainer readFromNBT(NBTTagCompound nbt) - { - ReagentStack reagent = ReagentStack.loadReagentStackFromNBT(nbt); - int capacity = nbt.getInteger("capacity"); - - if (reagent != null) - { - return new ReagentContainer(reagent, capacity); - } else - { - return new ReagentContainer(null, capacity); - } - } - - public NBTTagCompound writeToNBT(NBTTagCompound nbt) - { - if (reagentStack != null) - { - reagentStack.writeToNBT(nbt); - } - - nbt.setInteger("capacity", capacity); - - return nbt; - } - - @Override - public ReagentStack getReagent() - { - return reagentStack; - } - - @Override - public int getReagentStackAmount() - { - if (reagentStack == null) - { - return 0; - } - return reagentStack.amount; - } - - @Override - public int getCapacity() - { - return capacity; - } - - @Override - public int fill(ReagentStack resource, boolean doFill) - { - if (resource == null) - { - return 0; - } - - if (!doFill) - { - if (reagentStack == null) - { - return Math.min(capacity, resource.amount); - } - - if (!reagentStack.isReagentEqual(resource)) - { - return 0; - } - - return Math.min(capacity - reagentStack.amount, resource.amount); - } - - if (reagentStack == null) - { - reagentStack = new ReagentStack(resource, Math.min(capacity, resource.amount)); - - return reagentStack.amount; - } - - if (!reagentStack.isReagentEqual(resource)) - { - return 0; - } - int filled = capacity - reagentStack.amount; - - if (resource.amount < filled) - { - reagentStack.amount += resource.amount; - filled = resource.amount; - } else - { - reagentStack.amount = capacity; - } - - return filled; - } - - @Override - public ReagentStack drain(int maxDrain, boolean doDrain) - { - if (reagentStack == null) - { - return null; - } - - int drained = maxDrain; - if (reagentStack.amount < drained) - { - drained = reagentStack.amount; - } - - ReagentStack stack = new ReagentStack(reagentStack, drained); - if (doDrain) - { - reagentStack.amount -= drained; - if (reagentStack.amount <= 0) - { - reagentStack = null; - } - } - return stack; - } - - @Override - public ReagentContainerInfo getInfo() - { - return new ReagentContainerInfo(this); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java deleted file mode 100644 index 99521dc..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentContainerInfo.java +++ /dev/null @@ -1,19 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -public final class ReagentContainerInfo -{ - public final ReagentStack reagent; - public final int capacity; - - public ReagentContainerInfo(ReagentStack reagent, int capacity) - { - this.reagent = reagent; - this.capacity = capacity; - } - - public ReagentContainerInfo(IReagentContainer tank) - { - this.reagent = tank.getReagent(); - this.capacity = tank.getCapacity(); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java deleted file mode 100644 index 20b4393..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentRegistry.java +++ /dev/null @@ -1,174 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; - -import net.minecraft.item.ItemStack; - -public class ReagentRegistry -{ - public static Map reagentList = new HashMap(); - public static Map itemToReagentMap = new HashMap(); - - public static Reagent sanctusReagent; - public static Reagent incendiumReagent; - public static Reagent aquasalusReagent; - public static Reagent magicalesReagent; - public static Reagent aetherReagent; - public static Reagent crepitousReagent; - public static Reagent crystallosReagent; - public static Reagent terraeReagent; - public static Reagent tenebraeReagent; - - public static Reagent offensaReagent; - public static Reagent praesidiumReagent; - public static Reagent orbisTerraeReagent; - public static Reagent virtusReagent; - public static Reagent reductusReagent; - public static Reagent potentiaReagent; - - public static void initReagents() - { - sanctusReagent = new Reagent("sanctus"); - incendiumReagent = new Reagent("incendium"); - aquasalusReagent = new Reagent("aquasalus"); - magicalesReagent = new Reagent("magicales"); - aetherReagent = new Reagent("aether"); - crepitousReagent = new Reagent("crepitous"); - crystallosReagent = new Reagent("crystallos"); - terraeReagent = new Reagent("terrae"); - tenebraeReagent = new Reagent("tenebrae"); - offensaReagent = new Reagent("offensa"); - praesidiumReagent = new Reagent("praesidium"); - orbisTerraeReagent = new Reagent("orbisTerrae"); - virtusReagent = new Reagent("virtus"); - reductusReagent = new Reagent("reductus"); - potentiaReagent = new Reagent("potentia"); - - sanctusReagent.setColour(255, 255, 0, 255); - incendiumReagent.setColour(255, 0, 0, 255); - aquasalusReagent.setColour(0, 0, 255, 255); - magicalesReagent.setColour(150, 0, 146, 255); - aetherReagent.setColour(105, 223, 86, 255); - crepitousReagent.setColour(145, 145, 145, 255); - crystallosReagent.setColour(135, 255, 231, 255); - terraeReagent.setColour(147, 48, 13, 255); - tenebraeReagent.setColour(86, 86, 86, 255); - offensaReagent.setColour(126, 0, 0, 255); - praesidiumReagent.setColour(135, 135, 135, 255); - orbisTerraeReagent.setColour(32, 94, 14, 255); - virtusReagent.setColour(180, 0, 0, 255); - reductusReagent.setColour(20, 93, 2, 255); - potentiaReagent.setColour(64, 81, 208, 255); - - registerReagent("sanctus", sanctusReagent); - registerReagent("incendium", incendiumReagent); - registerReagent("aquasalus", aquasalusReagent); - registerReagent("magicales", magicalesReagent); - registerReagent("aether", aetherReagent); - registerReagent("crepitous", crepitousReagent); - registerReagent("crystallos", crystallosReagent); - registerReagent("terrae", terraeReagent); - registerReagent("tenebrae", tenebraeReagent); - registerReagent("offensa", offensaReagent); - registerReagent("praesidium", praesidiumReagent); - registerReagent("orbisTerrae", orbisTerraeReagent); - registerReagent("virtus", virtusReagent); - registerReagent("reductus", reductusReagent); - registerReagent("potentia", potentiaReagent); - } - - public static boolean registerReagent(String key, Reagent reagent) - { - if (reagentList.containsKey(key) || reagent == null) - { - return false; - } - - reagentList.put(key, reagent); - - return true; - } - - public static Reagent getReagentForKey(String key) - { - if (reagentList.containsKey(key)) - { - return reagentList.get(key); - } - - return null; - } - - public static String getKeyForReagent(Reagent reagent) - { - if (reagentList.containsValue(reagent)) - { - Set> set = reagentList.entrySet(); - for (Entry entry : set) - { - if (entry.getValue().equals(reagent)) - { - return entry.getKey(); - } - } - } - - return ""; - } - - public static void registerItemAndReagent(ItemStack stack, ReagentStack reagentStack) - { - itemToReagentMap.put(stack, reagentStack); - } - - public static ReagentStack getReagentStackForItem(ItemStack stack) - { - if (stack == null) - { - return null; - } - - for (Entry entry : itemToReagentMap.entrySet()) - { - if (entry.getKey() != null && entry.getKey().isItemEqual(stack)) - { - if (entry.getValue() == null) - { - return null; - } else - { - return entry.getValue().copy(); - } - } - } - - return null; - } - - public static ItemStack getItemForReagent(Reagent reagent) - { - if (reagent == null) - { - return null; - } - - for (Entry entry : itemToReagentMap.entrySet()) - { - if (entry.getValue() != null && entry.getValue().reagent == reagent) - { - if (entry.getKey() == null) - { - return null; - } else - { - return entry.getKey().copy(); - } - } - } - - return null; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java deleted file mode 100644 index f858397..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/ReagentStack.java +++ /dev/null @@ -1,63 +0,0 @@ -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraft.nbt.NBTTagCompound; - -public class ReagentStack -{ - public Reagent reagent; - public int amount; - - public ReagentStack(Reagent reagent, int amount) - { - this.reagent = reagent; - this.amount = amount; - } - - public ReagentStack(ReagentStack reagentStack, int amount) - { - this(reagentStack.reagent, amount); - } - - public static ReagentStack loadReagentStackFromNBT(NBTTagCompound tag) - { - Reagent reagent = ReagentRegistry.getReagentForKey(tag.getString("Reagent")); - - if (reagent == null) - { - return null; - } - - int amount = tag.getInteger("amount"); - ReagentStack stack = new ReagentStack(reagent, amount); - - return stack; - } - - public NBTTagCompound writeToNBT(NBTTagCompound tag) - { - tag.setString("Reagent", ReagentRegistry.getKeyForReagent(this.reagent)); - tag.setInteger("amount", this.amount); - - return tag; - } - - public ReagentStack splitStack(int amount) - { - ReagentStack copyStack = this.copy(); - int splitAmount = Math.min(amount, this.amount); - copyStack.amount = splitAmount; - this.amount -= splitAmount; - - return copyStack; - } - - public ReagentStack copy() - { - return new ReagentStack(this.reagent, this.amount); - } - - public boolean isReagentEqual(ReagentStack other) - { - return other != null && this.reagent == other.reagent; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java deleted file mode 100644 index 3e75464..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileReagentHandler.java +++ /dev/null @@ -1,66 +0,0 @@ - -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.ForgeDirection; - -public class TileReagentHandler extends TileEntity implements IReagentHandler -{ - protected ReagentContainer tank = new ReagentContainer(4000); - - @Override - public void readFromNBT(NBTTagCompound tag) - { - super.readFromNBT(tag); - tank.readFromNBT(tag); - } - - @Override - public void writeToNBT(NBTTagCompound tag) - { - super.writeToNBT(tag); - tank.writeToNBT(tag); - } - - /* IReagentHandler */ - @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { - return tank.fill(resource, doFill); - } - - @Override - public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) - { - if (resource == null || !resource.isReagentEqual(tank.getReagent())) - { - return null; - } - return tank.drain(resource.amount, doDrain); - } - - @Override - public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - return tank.drain(maxDrain, doDrain); - } - - @Override - public boolean canFill(ForgeDirection from, Reagent reagent) - { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Reagent reagent) - { - return true; - } - - @Override - public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) - { - return new ReagentContainerInfo[]{tank.getInfo()}; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java deleted file mode 100644 index a088b8a..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/alchemy/energy/TileSegmentedReagentHandler.java +++ /dev/null @@ -1,283 +0,0 @@ - -package WayofTime.alchemicalWizardry.api.alchemy.energy; - -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.tileentity.TileEntity; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.ForgeDirection; - -import java.util.HashMap; -import java.util.Map; -import java.util.Map.Entry; - -public class TileSegmentedReagentHandler extends TileEntity implements ISegmentedReagentHandler -{ - protected ReagentContainer[] tanks; - protected Map attunedTankMap; - - public TileSegmentedReagentHandler() - { - this(1); - } - - public TileSegmentedReagentHandler(int numberOfTanks) - { - this(numberOfTanks, 1000); - } - - public TileSegmentedReagentHandler(int numberOfTanks, int tankSize) - { - super(); - - this.attunedTankMap = new HashMap(); - this.tanks = new ReagentContainer[numberOfTanks]; - for (int i = 0; i < numberOfTanks; i++) - { - this.tanks[i] = new ReagentContainer(tankSize); - } - } - - @Override - public void readFromNBT(NBTTagCompound tag) - { - super.readFromNBT(tag); - - NBTTagList tagList = tag.getTagList("reagentTanks", Constants.NBT.TAG_COMPOUND); - - int size = tagList.tagCount(); - this.tanks = new ReagentContainer[size]; - - for (int i = 0; i < size; i++) - { - NBTTagCompound savedTag = tagList.getCompoundTagAt(i); - this.tanks[i] = ReagentContainer.readFromNBT(savedTag); - } - - NBTTagList attunedTagList = tag.getTagList("attunedTankMap", Constants.NBT.TAG_COMPOUND); - - for (int i = 0; i < attunedTagList.tagCount(); i++) - { - NBTTagCompound savedTag = attunedTagList.getCompoundTagAt(i); - Reagent reagent = ReagentRegistry.getReagentForKey(savedTag.getString("reagent")); - this.attunedTankMap.put(reagent, savedTag.getInteger("amount")); - } - } - - @Override - public void writeToNBT(NBTTagCompound tag) - { - super.writeToNBT(tag); - - NBTTagList tagList = new NBTTagList(); - - for (int i = 0; i < this.tanks.length; i++) - { - NBTTagCompound savedTag = new NBTTagCompound(); - if (this.tanks[i] != null) - { - this.tanks[i].writeToNBT(savedTag); - } - tagList.appendTag(savedTag); - } - - tag.setTag("reagentTanks", tagList); - - NBTTagList attunedTagList = new NBTTagList(); - - for (Entry entry : this.attunedTankMap.entrySet()) - { - NBTTagCompound savedTag = new NBTTagCompound(); - savedTag.setString("reagent", ReagentRegistry.getKeyForReagent(entry.getKey())); - savedTag.setInteger("amount", entry.getValue()); - attunedTagList.appendTag(savedTag); - } - - tag.setTag("attunedTankMap", attunedTagList); - } - - /* ISegmentedReagentHandler */ - @Override - public int fill(ForgeDirection from, ReagentStack resource, boolean doFill) - { - int totalFill = 0; - - boolean useTankLimit = !this.attunedTankMap.isEmpty(); - - if (resource != null) - { - int totalTanksFillable = useTankLimit ? this.getTanksTunedToReagent(resource.reagent) : this.tanks.length; - int tanksFilled = 0; - - int maxFill = resource.amount; - - for (int i = this.tanks.length - 1; i >= 0; i--) - { - ReagentStack remainingStack = resource.copy(); - remainingStack.amount = maxFill - totalFill; - - boolean doesReagentMatch = tanks[i].getReagent() == null ? false : tanks[i].getReagent().isReagentEqual(remainingStack); - - if (doesReagentMatch) - { - totalFill += tanks[i].fill(remainingStack, doFill); - tanksFilled++; - } else - { - continue; - } - - if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) - { - return totalFill; - } - } - - if (tanksFilled >= totalTanksFillable) - { - return totalFill; - } - - for (int i = this.tanks.length - 1; i >= 0; i--) - { - ReagentStack remainingStack = resource.copy(); - remainingStack.amount = maxFill - totalFill; - - boolean isTankEmpty = tanks[i].getReagent() == null; - - if (isTankEmpty) - { - totalFill += tanks[i].fill(remainingStack, doFill); - tanksFilled++; - } else - { - continue; - } - - if (totalFill >= maxFill || tanksFilled >= totalTanksFillable) - { - return totalFill; - } - } - } - return totalFill; - } - - @Override - public ReagentStack drain(ForgeDirection from, ReagentStack resource, boolean doDrain) - { - if (resource == null) - { - return null; - } - - int maxDrain = resource.amount; - Reagent reagent = resource.reagent; - int drained = 0; - - for (int i = 0; i < tanks.length; i++) - { - if (drained >= maxDrain) - { - break; - } - - if (resource.isReagentEqual(tanks[i].getReagent())) - { - ReagentStack drainStack = tanks[i].drain(maxDrain - drained, doDrain); - if (drainStack != null) - { - drained += drainStack.amount; - } - } - } - - return new ReagentStack(reagent, drained); - } - - /* Only returns the amount from the first available tank */ - @Override - public ReagentStack drain(ForgeDirection from, int maxDrain, boolean doDrain) - { - for (int i = 0; i < tanks.length; i++) - { - ReagentStack stack = tanks[i].drain(maxDrain, doDrain); - if (stack != null) - { - return stack; - } - } - - return null; - } - - @Override - public boolean canFill(ForgeDirection from, Reagent reagent) - { - return true; - } - - @Override - public boolean canDrain(ForgeDirection from, Reagent reagent) - { - return true; - } - - @Override - public ReagentContainerInfo[] getContainerInfo(ForgeDirection from) - { - ReagentContainerInfo[] info = new ReagentContainerInfo[this.getNumberOfTanks()]; - for (int i = 0; i < this.getNumberOfTanks(); i++) - { - info[i] = tanks[i].getInfo(); - } - return info; - } - - @Override - public int getNumberOfTanks() - { - return tanks.length; - } - - @Override - public int getTanksTunedToReagent(Reagent reagent) - { - if (this.attunedTankMap.containsKey(reagent) && this.attunedTankMap.get(reagent) != null) - { - return this.attunedTankMap.get(reagent); - } - return 0; - } - - @Override - public void setTanksTunedToReagent(Reagent reagent, int total) - { - if (total == 0 && this.attunedTankMap.containsKey(reagent)) - { - this.attunedTankMap.remove(reagent); - return; - } - - this.attunedTankMap.put(reagent, new Integer(total)); - } - - @Override - public Map getAttunedTankMap() - { - return this.attunedTankMap; - } - - public boolean areTanksEmpty() - { - for (int i = 0; i < this.tanks.length; i++) - { - if (tanks[i] != null && tanks[i].reagentStack != null) - { - return false; - } - } - - return true; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java deleted file mode 100644 index fab96be..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipe.java +++ /dev/null @@ -1,134 +0,0 @@ -package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; - -import java.util.Set; - -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; - -public class AltarRecipe -{ - public int minTier; - public int liquidRequired; - public boolean canBeFilled; //Tells the system that the item is an orb - public int consumptionRate; - public int drainRate; - public ItemStack requiredItem; - public ItemStack result; - public boolean useTag; - - public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { - this(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, false); - } - - public AltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled, boolean useTag) - { - this.result = result; - this.requiredItem = requiredItem; - this.minTier = minTier; - this.liquidRequired = liquidRequired; - this.consumptionRate = consumptionRate; - this.drainRate = drainRate; - this.canBeFilled = canBeFilled; - this.useTag = useTag; - } - - public ItemStack getResult() - { - return this.result; - } - - public ItemStack getRequiredItem() - { - return this.requiredItem; - } - - public boolean doesRequiredItemMatch(ItemStack comparedStack, int tierCheck) - { - if (comparedStack == null || this.requiredItem == null) - { - return false; - } - - return tierCheck >= minTier && this.requiredItem.isItemEqual(comparedStack) && (this.useTag ? this.areRequiredTagsEqual(comparedStack) : true); - } - - public boolean areRequiredTagsEqual(ItemStack comparedStack) - { - if(requiredItem.hasTagCompound()) - { - NBTTagCompound tag = requiredItem.getTagCompound(); - if(!comparedStack.hasTagCompound()) - { - return false; - } - - NBTTagCompound comparedTag = comparedStack.getTagCompound(); - - return this.areTagsEqual(tag, comparedTag); - } - - return true; - } - - protected boolean areTagsEqual(NBTTagCompound tag, NBTTagCompound comparedTag) - { - Set set = tag.func_150296_c(); - - for(Object obj : set) - { - if(obj instanceof String) - { - String str = (String)obj; - - NBTBase baseTag = comparedTag.getTag(str); - - if(baseTag instanceof NBTTagCompound) - { - NBTBase comparedBaseTag = comparedTag.getTag(str); - if(comparedBaseTag instanceof NBTTagCompound) - { - if(!this.areTagsEqual((NBTTagCompound) tag, comparedTag)) - { - return false; - } - } - }else - { - if(baseTag != null && !baseTag.equals(comparedTag.getTag(str))) - { - return false; - } - } - } - } - - return true; - } - - public int getMinTier() - { - return this.minTier; - } - - public int getLiquidRequired() - { - return this.liquidRequired; - } - - public int getConsumptionRate() - { - return this.consumptionRate; - } - - public int getDrainRate() - { - return this.drainRate; - } - - public boolean getCanBeFilled() - { - return this.canBeFilled; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java deleted file mode 100644 index d8077f3..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/altarRecipeRegistry/AltarRecipeRegistry.java +++ /dev/null @@ -1,65 +0,0 @@ -package WayofTime.alchemicalWizardry.api.altarRecipeRegistry; - -import net.minecraft.item.ItemStack; - -import java.util.LinkedList; -import java.util.List; - -public class AltarRecipeRegistry -{ - public static List altarRecipes = new LinkedList(); - - public static void registerAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { - altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled)); - } - - public static void registerNBTAltarRecipe(ItemStack result, ItemStack requiredItem, int minTier, int liquidRequired, int consumptionRate, int drainRate, boolean canBeFilled) - { - altarRecipes.add(new AltarRecipe(result, requiredItem, minTier, liquidRequired, consumptionRate, drainRate, canBeFilled, true)); - } - - public static void registerAltarOrbRecipe(ItemStack orbStack, int minTier, int consumptionRate) - { - registerAltarRecipe(null, orbStack, minTier, 0, consumptionRate, 0, true); - } - - public static boolean isRequiredItemValid(ItemStack testItem, int currentTierAltar) - { - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { - return true; - } - } - - return false; - } - - public static ItemStack getItemForItemAndTier(ItemStack testItem, int currentTierAltar) - { - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { - return ItemStack.copyItemStack(recipe.getResult()); - } - } - - return null; - } - - public static AltarRecipe getAltarRecipeForItemAndTier(ItemStack testItem, int currentTierAltar) - { - for (AltarRecipe recipe : altarRecipes) - { - if (recipe.doesRequiredItemMatch(testItem, currentTierAltar)) - { - return recipe; - } - } - - return null; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java deleted file mode 100644 index fc0ba2d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRecipe.java +++ /dev/null @@ -1,35 +0,0 @@ -package WayofTime.alchemicalWizardry.api.bindingRegistry; - -import net.minecraft.item.ItemStack; - -public class BindingRecipe -{ - public ItemStack requiredItem; - public ItemStack outputItem; - - public BindingRecipe(ItemStack outputItem, ItemStack requiredItem) - { - this.requiredItem = requiredItem; - this.outputItem = outputItem; - } - - public boolean doesRequiredItemMatch(ItemStack testStack) - { - if (testStack == null || this.requiredItem == null) - { - return false; - } - - return this.requiredItem.isItemEqual(testStack); - } - - public ItemStack getResult(ItemStack inputItem) - { - return this.getResult(); - } - - public ItemStack getResult() - { - return this.outputItem; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java deleted file mode 100644 index ba06911..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/bindingRegistry/BindingRegistry.java +++ /dev/null @@ -1,67 +0,0 @@ -package WayofTime.alchemicalWizardry.api.bindingRegistry; - -import net.minecraft.item.ItemStack; - -import java.util.LinkedList; -import java.util.List; - -public class BindingRegistry -{ - public static List bindingRecipes = new LinkedList(); - - public static void registerRecipe(ItemStack output, ItemStack input) - { - bindingRecipes.add(new BindingRecipe(output, input)); - } - - public static boolean isRequiredItemValid(ItemStack testItem) - { - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { - return true; - } - } - - return false; - } - - public static ItemStack getItemForItemAndTier(ItemStack testItem) - { - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { - return recipe.getResult(testItem).copy(); - } - } - - return null; - } - - public static int getIndexForItem(ItemStack testItem) - { - int i = 0; - for (BindingRecipe recipe : bindingRecipes) - { - if (recipe.doesRequiredItemMatch(testItem)) - { - return i; - } - i++; - } - - return -1; - } - - public static ItemStack getOutputForIndex(int index) - { - if (bindingRecipes.size() <= index) - { - return null; - } - - return bindingRecipes.get(index).getResult(); - } -} 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/AddToNetworkEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java deleted file mode 100644 index ddcc3b0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/AddToNetworkEvent.java +++ /dev/null @@ -1,38 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import cpw.mods.fml.common.eventhandler.Cancelable; -import cpw.mods.fml.common.eventhandler.Event; - -@Cancelable -public class AddToNetworkEvent extends Event -{ - public String ownerNetwork; - public int addedAmount; - public int maximum; - - /** - * This event is called whenever the network is added to. If cancelled, no LP will be drained from the source. If result is set to Result.DENY, - * the LP will still be drained but the soul network will not be added to. - * - * @param ownerNetwork Key used for the soul network - * @param addedAmount Amount added - * @param maximum Ceiling that the network can add to - */ - public AddToNetworkEvent(String ownerNetwork, int addedAmount, int maximum) - { - super(); - this.ownerNetwork = ownerNetwork; - this.addedAmount = addedAmount; - this.maximum = maximum; - } - - public String getOwnerNetwork() - { - return this.ownerNetwork; - } - - public int getAddedAmount() - { - return this.addedAmount; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java deleted file mode 100644 index a0a9273..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemBindEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Event; - -public class ItemBindEvent extends Event -{ - public final EntityPlayer player; - public String key; - public ItemStack itemStack; - - public ItemBindEvent(EntityPlayer player, String key, ItemStack itemStack) - { - super(); - this.player = player; - this.key = key; - this.itemStack = itemStack; - } -} 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/ItemDrainNetworkEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java deleted file mode 100644 index d75fd7d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/ItemDrainNetworkEvent.java +++ /dev/null @@ -1,29 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class ItemDrainNetworkEvent extends PlayerDrainNetworkEvent -{ - public final ItemStack itemStack; - public boolean shouldDamage; //If true, will damage regardless of if the network had enough inside it - public float damageAmount; //Amount of damage that would incur if the network could not drain properly - - /** - * Set result to deny the action i.e. damage/drain anyways. Cancelling event prevents action without penalties - * - * @param player Player using the item - * @param ownerNetwork Network that the item is tied to - * @param itemStack Item used - * @param drainAmount Original drain amount - change to alter cost - */ - public ItemDrainNetworkEvent(EntityPlayer player, String ownerNetwork, ItemStack itemStack, int drainAmount) - { - super(player, ownerNetwork, drainAmount); - this.itemStack = itemStack; - this.shouldDamage = false; - this.damageAmount = (float)(drainAmount) / 100.0f; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java deleted file mode 100644 index f752255..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerAddToNetworkEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class PlayerAddToNetworkEvent extends AddToNetworkEvent -{ - public final EntityPlayer player; - public ItemStack itemStack; - public PlayerAddToNetworkEvent(EntityPlayer player, ItemStack itemStack, String ownerNetwork, int addedAmount, int maximum) - { - super(ownerNetwork, addedAmount, maximum); - this.player = player; - this.itemStack = itemStack; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java deleted file mode 100644 index dacb26d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/PlayerDrainNetworkEvent.java +++ /dev/null @@ -1,20 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.entity.player.EntityPlayer; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class PlayerDrainNetworkEvent extends SoulNetworkEvent -{ - public final EntityPlayer player; //Player that activated the event - public PlayerDrainNetworkEvent(EntityPlayer player, String ownerNetwork, int drainAmount) - { - super(ownerNetwork, drainAmount); - this.player = player; - } - - public EntityPlayer getPlayer() - { - return player; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java deleted file mode 100644 index 83c10c0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualActivatedEvent.java +++ /dev/null @@ -1,23 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class RitualActivatedEvent extends RitualEvent -{ - public final EntityPlayer player; - public final ItemStack crystalStack; - public int crystalTier; - - public RitualActivatedEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, EntityPlayer player, ItemStack activationCrystal, int crystalTier) - { - super(mrs, ownerKey, ritualKey); - - this.player = player; - this.crystalStack = activationCrystal; - this.crystalTier = crystalTier; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java deleted file mode 100644 index fbe1649..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualEvent.java +++ /dev/null @@ -1,18 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import cpw.mods.fml.common.eventhandler.Event; - -public class RitualEvent extends Event -{ - public final IMasterRitualStone mrs; - public String ownerKey; - public final String ritualKey; - - public RitualEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) - { - this.mrs = mrs; - this.ownerKey = ownerKey; - this.ritualKey = ritualKey; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java deleted file mode 100644 index 4bcf075..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualRunEvent.java +++ /dev/null @@ -1,16 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import cpw.mods.fml.common.eventhandler.Cancelable; - -@Cancelable -public class RitualRunEvent extends RitualEvent -{ - - - public RitualRunEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey) - { - super(mrs, ownerKey, ritualKey); - } - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java deleted file mode 100644 index 4fc998f..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/RitualStopEvent.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import WayofTime.alchemicalWizardry.api.rituals.IMasterRitualStone; -import WayofTime.alchemicalWizardry.api.rituals.RitualBreakMethod; - -public class RitualStopEvent extends RitualEvent -{ - public final RitualBreakMethod method; - public RitualStopEvent(IMasterRitualStone mrs, String ownerKey, String ritualKey, RitualBreakMethod method) - { - super(mrs, ownerKey, ritualKey); - - this.method = method; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java b/src/api/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java deleted file mode 100644 index bf47a13..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/event/SoulNetworkEvent.java +++ /dev/null @@ -1,26 +0,0 @@ -package WayofTime.alchemicalWizardry.api.event; - -import cpw.mods.fml.common.eventhandler.Event; - -public class SoulNetworkEvent extends Event -{ - public String ownerNetwork; - public int drainAmount; - - public SoulNetworkEvent(String ownerNetwork, int drainAmount) - { - super(); - this.ownerNetwork = ownerNetwork; - this.drainAmount = drainAmount; - } - - public String getOwnerNetwork() - { - return this.ownerNetwork; - } - - public int getDrainAmount() - { - return this.drainAmount; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java deleted file mode 100644 index aac57f5..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/harvest/HarvestRegistry.java +++ /dev/null @@ -1,33 +0,0 @@ -package WayofTime.alchemicalWizardry.api.harvest; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -import java.util.ArrayList; -import java.util.List; - -public class HarvestRegistry -{ - public static List handlerList = new ArrayList(); - - public static void registerHarvestHandler(IHarvestHandler handler) - { - handlerList.add(handler); - } - - public static boolean harvestBlock(World world, int xCoord, int yCoord, int zCoord) - { - Block block = world.getBlock(xCoord, yCoord, zCoord); - int meta = world.getBlockMetadata(xCoord, yCoord, zCoord); - - for (IHarvestHandler handler : handlerList) - { - if (handler.harvestAndPlant(world, xCoord, yCoord, zCoord, block, meta)) - { - return true; - } - } - - return false; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java b/src/api/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java deleted file mode 100644 index d5e479d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/harvest/IHarvestHandler.java +++ /dev/null @@ -1,20 +0,0 @@ -package WayofTime.alchemicalWizardry.api.harvest; - -import net.minecraft.block.Block; -import net.minecraft.world.World; - -public interface IHarvestHandler -{ - /** - * A handler that is used to harvest and replant the block at the specified location - * - * @param world - * @param xCoord - * @param yCoord - * @param zCoord - * @param block block at this given location - * @param meta meta at this given location - * @return true if successfully harvested, false if not - */ - public boolean harvestAndPlant(World world, int xCoord, int yCoord, int zCoord, Block block, int meta); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java deleted file mode 100644 index b84f95c..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/IAltarManipulator.java +++ /dev/null @@ -1,6 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items; - -public interface IAltarManipulator -{ - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java deleted file mode 100644 index 72f0c83..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/ItemSpellMultiTool.java +++ /dev/null @@ -1,806 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items; - -import java.util.HashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.Random; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.DamageSource; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.DimensionManager; -import net.minecraftforge.common.util.Constants; -import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; -import WayofTime.alchemicalWizardry.api.spell.APISpellHelper; -import WayofTime.alchemicalWizardry.api.spell.SpellEffect; -import WayofTime.alchemicalWizardry.api.spell.SpellParadigmTool; - -public class ItemSpellMultiTool extends Item -{ - private static final String harvestLevelSuffix = "harvestLvl"; - private static final String digLevelSuffix = "digLvl"; - private static final String tagName = "BloodMagicTool"; - private Random rand = new Random(); - - public ItemSpellMultiTool() - { - super(); - this.setMaxDamage(0); - this.setMaxStackSize(1); - this.setFull3D(); - } - - @Override - public void registerIcons(IIconRegister iconRegister) - { - this.itemIcon = iconRegister.registerIcon("AlchemicalWizardry:BoundTool"); - } - - @Override - public boolean hitEntity(ItemStack par1ItemStack, EntityLivingBase par2EntityLivingBase, EntityLivingBase par3EntityLivingBase) - { - float damage = this.getCustomItemAttack(par1ItemStack); - - SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack); - - if (parad != null) - { - parad.onLeftClickEntity(par1ItemStack, par2EntityLivingBase, par3EntityLivingBase); - } - - damage += parad.getAddedDamageForEntity(par2EntityLivingBase); - - if (rand.nextFloat() < this.getCritChance(par1ItemStack)) - { - damage *= 1.75f; - } - - if (par3EntityLivingBase instanceof EntityPlayer) - { - par2EntityLivingBase.attackEntityFrom(DamageSource.causePlayerDamage((EntityPlayer) par3EntityLivingBase), damage); - } else - { - par2EntityLivingBase.attackEntityFrom(DamageSource.causeMobDamage(par3EntityLivingBase), damage); - } - - return true; - } - - @Override - public boolean onLeftClickEntity(ItemStack stack, EntityPlayer player, Entity entity) - { - SpellParadigmTool parad = this.loadParadigmFromStack(stack); - - if (parad != null && entity instanceof EntityLivingBase) - { - parad.onLeftClickEntity(stack, (EntityLivingBase) entity, player); - } - - return false; - } - - @Override - public boolean onBlockStartBreak(ItemStack stack, int x, int y, int z, EntityPlayer player) - { - if (player.worldObj.isRemote) - { - return false; - } - - if (!stack.hasTagCompound()) - return false; - - World world = player.worldObj; - Block block = player.worldObj.getBlock(x, y, z); - int meta = world.getBlockMetadata(x, y, z); - if (block == null || block == Blocks.air) - return false; - int hlvl = -1; - float blockHardness = block.getBlockHardness(world, x, y, z); - - MovingObjectPosition mop = APISpellHelper.raytraceFromEntity(world, player, true, 5.0D); - - Block localBlock = world.getBlock(x, y, z); - int localMeta = world.getBlockMetadata(x, y, z); - String toolClass = block.getHarvestTool(meta); - if (toolClass != null && this.getHarvestLevel(stack, toolClass) != -1) - hlvl = block.getHarvestLevel(meta); - int toolLevel = this.getHarvestLevel(stack, toolClass); - - float localHardness = localBlock == null ? Float.MAX_VALUE : localBlock.getBlockHardness(world, x, y, z); - - if (hlvl <= toolLevel && localHardness - 1.5 <= blockHardness) - { - boolean cancelHarvest = false; - - if (!cancelHarvest) - { - if (localBlock != null && !(localHardness < 0)) - { - boolean isEffective = false; - - String localToolClass = this.getToolClassForMaterial(localBlock.getMaterial()); - - if (localToolClass != null && this.getHarvestLevel(stack, toolClass) >= localBlock.getHarvestLevel(localMeta)) - { - isEffective = true; - } - - - if (localBlock.getMaterial().isToolNotRequired()) - { - isEffective = true; - } - - if (!player.capabilities.isCreativeMode) - { - if (isEffective) - { - if (localBlock.removedByPlayer(world, player, x, y, z)) - { - localBlock.onBlockDestroyedByPlayer(world, x, y, z, localMeta); - } - localBlock.onBlockHarvested(world, x, y, z, localMeta, player); - if (blockHardness > 0f) - onBlockDestroyed(stack, world, localBlock, x, y, z, player); - - List items = APISpellHelper.getItemsFromBlock(world, localBlock, x, y, z, localMeta, this.getSilkTouch(stack), this.getFortuneLevel(stack)); - - SpellParadigmTool parad = this.loadParadigmFromStack(stack); - List newItems = parad.handleItemList(stack, items); - - if (!world.isRemote) - { - APISpellHelper.spawnItemListInWorld(newItems, world, x + 0.5f, y + 0.5f, z + 0.5f); - } - - world.func_147479_m(x, y, z); - - int cost = 0; - - cost += parad.digSurroundingArea(stack, world, player, mop, localToolClass, localHardness, toolLevel, this); - - cost += parad.onBreakBlock(stack, world, player, localBlock, localMeta, x, y, z, ForgeDirection.getOrientation(mop.sideHit)); - - if (cost > 0) - { - SoulNetworkHandler.syphonAndDamageFromNetwork(stack, player, cost); - } - } else - { - world.setBlockToAir(x, y, z); - world.func_147479_m(x, y, z); - } - - } else - { - world.setBlockToAir(x, y, z); - world.func_147479_m(x, y, z); - } - } - } - } - - if (!world.isRemote) - world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(block) + (meta << 12)); - return true; - - } - - public Material[] getMaterialsForToolclass(String toolClass) - { - if ("pickaxe".equals(toolClass)) - { - return new Material[]{Material.rock, Material.iron, Material.ice, Material.glass, Material.piston, Material.anvil, Material.circuits}; - } else if ("shovel".equals(toolClass)) - { - return new Material[]{Material.grass, Material.ground, Material.sand, Material.snow, Material.craftedSnow, Material.clay}; - } else if ("axe".equals(toolClass)) - { - return new Material[]{Material.wood, Material.vine, Material.circuits, Material.cactus}; - } - return new Material[0]; - } - - public String getToolClassForMaterial(Material mat) - { - String testString = "pickaxe"; - - Material[] matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { - return testString; - } - } - - testString = "shovel"; - matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { - return testString; - } - } - - testString = "axe"; - matList = this.getMaterialsForToolclass(testString); - for (int i = 0; i < matList.length; i++) - { - if (matList[i] == mat) - { - return testString; - } - } - - return null; - } - - public Set getToolClasses(ItemStack stack) - { - Set set = new HashSet(); - - if (this.getHarvestLevel(stack, "pickaxe") > -1) - { - set.add("pickaxe"); - } - - if (this.getHarvestLevel(stack, "axe") > -1) - { - set.add("axe"); - } - - if (this.getHarvestLevel(stack, "shovel") > -1) - { - set.add("shovel"); - } - - return set; - } - - @Override - public float getDigSpeed(ItemStack stack, Block block, int meta) - { - String toolClass = block.getHarvestTool(meta); - - if (toolClass == null || toolClass.equals("")) - { - return 1.0f; - } - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - return tag.getFloat(digLevelSuffix + toolClass); - } else - { - stack.setTagCompound(new NBTTagCompound()); - } - } - - return 1.0f; - } - - @Override - public int getHarvestLevel(ItemStack stack, String toolClass) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - if (tag.hasKey(harvestLevelSuffix + toolClass)) - { - return tag.getInteger(harvestLevelSuffix + toolClass); - } else - { - return -1; - } - } else - { - stack.setTagCompound(new NBTTagCompound()); - } - - return -1; - } - - @Override - public boolean canHarvestBlock(Block par1Block, ItemStack itemStack) - { - - return true; - } - - @Override - public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) - { - return false; - } - - @Override - public void onUpdate(ItemStack toolStack, World world, Entity par3Entity, int par4, boolean par5) - { - if (world.isRemote) - { - return; - } - - SpellParadigmTool parad = this.loadParadigmFromStack(toolStack); - int cost = parad.onUpdate(toolStack, world, par3Entity, par4, par5); - - if (par3Entity instanceof EntityPlayer && cost > 0) - SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, cost); - - int duration = Math.max(this.getDuration(toolStack, world), 0); - - if (duration <= 0 && par3Entity instanceof EntityPlayer) - { - int banishCost = parad.onBanishTool(toolStack, world, par3Entity, par4, par5); - SoulNetworkHandler.syphonAndDamageFromNetwork(toolStack, (EntityPlayer) par3Entity, banishCost); - ((EntityPlayer) par3Entity).inventory.mainInventory[par4] = this.getContainedCrystal(toolStack); - } - } - - @Override - public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) - { - if (par3EntityPlayer.isSneaking()) - { - par3EntityPlayer.setCurrentItemOrArmor(0, this.getContainedCrystal(par1ItemStack)); - return par1ItemStack; - } - - SpellParadigmTool parad = this.loadParadigmFromStack(par1ItemStack); - - MovingObjectPosition mop = this.getMovingObjectPositionFromPlayer(par2World, par3EntityPlayer, false); - - int cost = 0; - - if (mop != null && mop.typeOfHit.equals(MovingObjectPosition.MovingObjectType.BLOCK)) - { - cost = parad.onRightClickBlock(par1ItemStack, par3EntityPlayer, par2World, mop); - } else - { - cost = parad.onRightClickAir(par1ItemStack, par2World, par3EntityPlayer); - } - - if (cost > 0) - { - SoulNetworkHandler.syphonAndDamageFromNetwork(par1ItemStack, par3EntityPlayer, cost); - } - - return par1ItemStack; - } - - @Override - public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) - { - par3List.add("A mace filled with ancient alchemy"); - - if (!(par1ItemStack.stackTagCompound == null)) - { - if (!par1ItemStack.stackTagCompound.getString("ownerName").equals("")) - { - par3List.add("Current owner: " + par1ItemStack.stackTagCompound.getString("ownerName")); - } - - for (String str : this.getToolListString(par1ItemStack)) - { - par3List.add(str); - } - - par3List.add(""); - float damage = this.getCustomItemAttack(par1ItemStack); - par3List.add("\u00A79+" + ((int) (damage * 10)) / 10.0f + " " + "Attack Damage"); - float critChance = ((int) (this.getCritChance(par1ItemStack) * 1000)) / 10.0f; - par3List.add("\u00A79+" + critChance + "% " + "Crit Chance"); - } - } - - //--------------Custom methods--------------// - - public void setHarvestLevel(ItemStack stack, String toolClass, int harvestLevel) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1, harvestLevel)); - - stack.getTagCompound().setTag(tagName, tag); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setInteger(harvestLevelSuffix + toolClass, Math.max(-1, harvestLevel)); - - stack.getTagCompound().setTag(tagName, tag); - } - } - - public void setDigSpeed(ItemStack stack, String toolClass, float digSpeed) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setFloat(digLevelSuffix + toolClass, digSpeed); - - stack.getTagCompound().setTag(tagName, tag); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setFloat(digLevelSuffix + toolClass, digSpeed); - - stack.getTagCompound().setTag(tagName, tag); - } - } - - public float getDigSpeed(ItemStack stack, String toolClass) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - return tag.getFloat(digLevelSuffix + toolClass); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - return 0.0f; - } - } - - public void setItemAttack(ItemStack stack, float damage) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setFloat("itemAttack", Math.max(damage, 0.0f)); - - stack.stackTagCompound.setTag(tagName, tag); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setFloat("itemAttack", Math.max(damage, 0.0f)); - - stack.stackTagCompound.setTag(tagName, tag); - } - } - - public float getCustomItemAttack(ItemStack stack) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - return tag.getFloat("itemAttack"); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - return 0.0f; - } - } - - public ItemStack getContainedCrystal(ItemStack container) - { - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName).getCompoundTag("heldItem"); - - return ItemStack.loadItemStackFromNBT(tag); - } else - { - container.setTagCompound(new NBTTagCompound()); - - return null; - } - } - - public void setContainedCrystal(ItemStack container, ItemStack crystal) - { - if (container.hasTagCompound()) - { - NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName); - NBTTagCompound tag = compTag.getCompoundTag("heldItem"); - - crystal.writeToNBT(tag); - - compTag.setTag("heldItem", tag); - container.getTagCompound().setTag(tagName, compTag); - } else - { - container.setTagCompound(new NBTTagCompound()); - - NBTTagCompound compTag = container.getTagCompound().getCompoundTag(tagName); - NBTTagCompound tag = compTag.getCompoundTag("heldItem"); - - crystal.writeToNBT(tag); - - compTag.setTag("heldItem", tag); - container.getTagCompound().setTag(tagName, compTag); - } - } - - public void setDuration(ItemStack container, World world, int duration) - { - if (world.isRemote) - { - return; - } else - { - World overWorld = DimensionManager.getWorld(0); - long worldtime = overWorld.getTotalWorldTime(); - - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - tag.setLong("duration", Math.max(duration + worldtime, worldtime)); - - container.getTagCompound().setTag(tagName, tag); - } else - { - container.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - tag.setLong("duration", Math.max(duration + worldtime, worldtime)); - - container.getTagCompound().setTag(tagName, tag); - } - } - } - - public int getDuration(ItemStack container, World world) - { - if (world.isRemote) - { - return 0; - } else - { - World overWorld = DimensionManager.getWorld(0); - long worldtime = overWorld.getTotalWorldTime(); - - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - return (int) (tag.getLong("duration") - worldtime); - } else - { - container.setTagCompound(new NBTTagCompound()); - - return 0; - } - } - } - - public void loadParadigmIntoStack(ItemStack container, List list) - { - if (!container.hasTagCompound()) - { - container.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); - - NBTTagList effectList = new NBTTagList(); - - for (SpellEffect eff : list) - { - effectList.appendTag(eff.getTag()); - } - - tagiest.setTag("Effects", effectList); - - container.getTagCompound().setTag(tagName, tagiest); - } - - public SpellParadigmTool loadParadigmFromStack(ItemStack container) - { - if (!container.hasTagCompound()) - { - container.setTagCompound(new NBTTagCompound()); - } - NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); - - NBTTagList tagList = tagiest.getTagList("Effects", Constants.NBT.TAG_COMPOUND); - - List spellEffectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { - NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); - - SpellEffect eff = SpellEffect.getEffectFromTag(tag); - if (eff != null) - { - spellEffectList.add(eff); - } - } - - return SpellParadigmTool.getParadigmForEffectArray(spellEffectList); - } - - public void setSilkTouch(ItemStack stack, boolean silkTouch) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setBoolean("silkTouch", silkTouch); - - stack.stackTagCompound.setTag(tagName, tag); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setBoolean("silkTouch", silkTouch); - - stack.stackTagCompound.setTag(tagName, tag); - } - } - - public boolean getSilkTouch(ItemStack stack) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - return tag.getBoolean("silkTouch"); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - return false; - } - } - - public void setFortuneLevel(ItemStack stack, int fortune) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setInteger("fortuneLevel", Math.max(fortune, 0)); - - stack.stackTagCompound.setTag(tagName, tag); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - tag.setInteger("fortuneLevel", Math.max(fortune, 0)); - - stack.stackTagCompound.setTag(tagName, tag); - } - } - - public int getFortuneLevel(ItemStack stack) - { - if (stack.hasTagCompound()) - { - NBTTagCompound tag = stack.getTagCompound().getCompoundTag(tagName); - - return tag.getInteger("fortuneLevel"); - } else - { - stack.setTagCompound(new NBTTagCompound()); - - return 0; - } - } - - public List getToolListString(ItemStack container) - { - if (!container.hasTagCompound()) - { - container.setTagCompound(new NBTTagCompound()); - } - NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); - - NBTTagList tagList = tagiest.getTagList("ToolTips", Constants.NBT.TAG_COMPOUND); - - List toolTipList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { - NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); - - String str = tag.getString("tip"); - if (str != null) - { - toolTipList.add(str); - } - } - - return toolTipList; - } - - public void setToolListString(ItemStack container, List toolTipString) - { - if (!container.hasTagCompound()) - { - container.setTagCompound(new NBTTagCompound()); - } - - NBTTagCompound tagiest = container.getTagCompound().getCompoundTag(tagName); - - NBTTagList stringList = new NBTTagList(); - - for (String str : toolTipString) - { - NBTTagCompound tag = new NBTTagCompound(); - tag.setString("tip", str); - - stringList.appendTag(tag); - } - - tagiest.setTag("ToolTips", stringList); - - container.getTagCompound().setTag(tagName, tagiest); - } - - public void setCritChance(ItemStack container, float chance) - { - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - tag.setFloat("critChance", Math.max(chance, 0)); - - container.stackTagCompound.setTag(tagName, tag); - } else - { - container.setTagCompound(new NBTTagCompound()); - - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - tag.setFloat("critChance", Math.max(chance, 0)); - - container.stackTagCompound.setTag(tagName, tag); - } - } - - public float getCritChance(ItemStack container) - { - if (container.hasTagCompound()) - { - NBTTagCompound tag = container.getTagCompound().getCompoundTag(tagName); - - return tag.getFloat("critChance"); - } else - { - container.setTagCompound(new NBTTagCompound()); - - return 0; - } - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java deleted file mode 100644 index 6e5b0f9..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapedBloodOrbRecipe.java +++ /dev/null @@ -1,281 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items; - -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import net.minecraft.block.Block; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapedRecipes; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.Iterator; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Shaped Blood Orb Recipe Handler by joshie * - */ -public class ShapedBloodOrbRecipe implements IRecipe -{ - private static final int MAX_CRAFT_GRID_WIDTH = 3; - private static final int MAX_CRAFT_GRID_HEIGHT = 3; - - private ItemStack output = null; - private Object[] input = null; - public int width = 0; - public int height = 0; - private boolean mirrored = true; - - public ShapedBloodOrbRecipe(Block result, Object... recipe) - { - this(new ItemStack(result), recipe); - } - - public ShapedBloodOrbRecipe(Item result, Object... recipe) - { - this(new ItemStack(result), recipe); - } - - public ShapedBloodOrbRecipe(ItemStack result, Object... recipe) - { - output = result.copy(); - - String shape = ""; - int idx = 0; - - if (recipe[idx] instanceof Boolean) - { - mirrored = (Boolean) recipe[idx]; - if (recipe[idx + 1] instanceof Object[]) - { - recipe = (Object[]) recipe[idx + 1]; - } else - { - idx = 1; - } - } - - if (recipe[idx] instanceof String[]) - { - String[] parts = ((String[]) recipe[idx++]); - - for (String s : parts) - { - width = s.length(); - shape += s; - } - - height = parts.length; - } else - { - while (recipe[idx] instanceof String) - { - String s = (String) recipe[idx++]; - shape += s; - width = s.length(); - height++; - } - } - - if (width * height != shape.length()) - { - String ret = "Invalid shaped ore recipe: "; - for (Object tmp : recipe) - { - ret += tmp + ", "; - } - ret += output; - throw new RuntimeException(ret); - } - - HashMap itemMap = new HashMap(); - - for (; idx < recipe.length; idx += 2) - { - Character chr = (Character) recipe[idx]; - Object in = recipe[idx + 1]; - - if (in instanceof IBloodOrb || (in instanceof ItemStack && ((ItemStack) in).getItem() instanceof IBloodOrb)) - { //If the item is an instanceof IBloodOrb then save the level of the orb - if (in instanceof ItemStack) - itemMap.put(chr, (Integer) (((IBloodOrb) ((ItemStack) in).getItem()).getOrbLevel())); - else itemMap.put(chr, (Integer) (((IBloodOrb) in).getOrbLevel())); - } else if (in instanceof ItemStack) - { - itemMap.put(chr, ((ItemStack) in).copy()); - } else if (in instanceof Item) - { - itemMap.put(chr, new ItemStack((Item) in)); - } else if (in instanceof Block) - { - itemMap.put(chr, new ItemStack((Block) in, 1, OreDictionary.WILDCARD_VALUE)); - } else if (in instanceof String) - { - itemMap.put(chr, OreDictionary.getOres((String) in)); - } else - { - String ret = "Invalid shaped ore recipe: "; - for (Object tmp : recipe) - { - ret += tmp + ", "; - } - ret += output; - throw new RuntimeException(ret); - } - } - - input = new Object[width * height]; - int x = 0; - for (char chr : shape.toCharArray()) - { - input[x++] = itemMap.get(chr); - } - } - - ShapedBloodOrbRecipe(ShapedRecipes recipe, Map replacements) - { - output = recipe.getRecipeOutput(); - width = recipe.recipeWidth; - height = recipe.recipeHeight; - - input = new Object[recipe.recipeItems.length]; - - for (int i = 0; i < input.length; i++) - { - ItemStack ingred = recipe.recipeItems[i]; - - if (ingred == null) - continue; - - input[i] = recipe.recipeItems[i]; - - for (Entry replace : replacements.entrySet()) - { - if (OreDictionary.itemMatches(replace.getKey(), ingred, true)) - { - input[i] = OreDictionary.getOres(replace.getValue()); - break; - } - } - } - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting var1) - { - return output.copy(); - } - - @Override - public int getRecipeSize() - { - return input.length; - } - - @Override - public ItemStack getRecipeOutput() - { - return output; - } - - @Override - public boolean matches(InventoryCrafting inv, World world) - { - for (int x = 0; x <= MAX_CRAFT_GRID_WIDTH - width; x++) - { - for (int y = 0; y <= MAX_CRAFT_GRID_HEIGHT - height; ++y) - { - if (checkMatch(inv, x, y, false)) - { - return true; - } - - if (mirrored && checkMatch(inv, x, y, true)) - { - return true; - } - } - } - - return false; - } - - @SuppressWarnings("unchecked") - private boolean checkMatch(InventoryCrafting inv, int startX, int startY, boolean mirror) - { - for (int x = 0; x < MAX_CRAFT_GRID_WIDTH; x++) - { - for (int y = 0; y < MAX_CRAFT_GRID_HEIGHT; y++) - { - int subX = x - startX; - int subY = y - startY; - Object target = null; - - if (subX >= 0 && subY >= 0 && subX < width && subY < height) - { - if (mirror) - { - target = input[width - subX - 1 + subY * width]; - } else - { - target = input[subX + subY * width]; - } - } - - ItemStack slot = inv.getStackInRowAndColumn(x, y); - //If target is integer, then we should be check the blood orb value of the item instead - if (target instanceof Integer) - { - if (slot != null && slot.getItem() instanceof IBloodOrb) - { - IBloodOrb orb = (IBloodOrb) slot.getItem(); - if (orb.getOrbLevel() < (Integer) target) - { - return false; - } - } else return false; - } else if (target instanceof ItemStack) - { - if (!OreDictionary.itemMatches((ItemStack) target, slot, false)) - { - return false; - } - } else if (target instanceof ArrayList) - { - boolean matched = false; - - Iterator itr = ((ArrayList) target).iterator(); - while (itr.hasNext() && !matched) - { - matched = OreDictionary.itemMatches(itr.next(), slot, false); - } - - if (!matched) - { - return false; - } - } else if (target == null && slot != null) - { - return false; - } - } - } - - return true; - } - - public ShapedBloodOrbRecipe setMirrored(boolean mirror) - { - mirrored = mirror; - return this; - } - - public Object[] getInput() - { - return this.input; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java deleted file mode 100644 index 3b22ded..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/ShapelessBloodOrbRecipe.java +++ /dev/null @@ -1,174 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items; - -import WayofTime.alchemicalWizardry.api.items.interfaces.IBloodOrb; -import net.minecraft.block.Block; -import net.minecraft.inventory.InventoryCrafting; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.item.crafting.IRecipe; -import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -/** - * Shapeless Blood Orb Recipe Handler by joshie * - */ -public class ShapelessBloodOrbRecipe implements IRecipe -{ - private ItemStack output = null; - private ArrayList input = new ArrayList(); - - public ShapelessBloodOrbRecipe(Block result, Object... recipe) - { - this(new ItemStack(result), recipe); - } - - public ShapelessBloodOrbRecipe(Item result, Object... recipe) - { - this(new ItemStack(result), recipe); - } - - public ShapelessBloodOrbRecipe(ItemStack result, Object... recipe) - { - output = result.copy(); - for (Object in : recipe) - { - 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 Item) - { - input.add(new ItemStack((Item) in)); - } else if (in instanceof Block) - { - input.add(new ItemStack((Block) in)); - } else if (in instanceof String) - { - input.add(OreDictionary.getOres((String) in)); - } else - { - String ret = "Invalid shapeless ore recipe: "; - for (Object tmp : recipe) - { - ret += tmp + ", "; - } - ret += output; - throw new RuntimeException(ret); - } - } - } - - @SuppressWarnings("unchecked") - ShapelessBloodOrbRecipe(ShapelessRecipes recipe, Map replacements) - { - output = recipe.getRecipeOutput(); - - for (ItemStack ingred : ((List) recipe.recipeItems)) - { - Object finalObj = ingred; - for (Entry replace : replacements.entrySet()) - { - if (OreDictionary.itemMatches(replace.getKey(), ingred, false)) - { - finalObj = OreDictionary.getOres(replace.getValue()); - break; - } - } - input.add(finalObj); - } - } - - @Override - public int getRecipeSize() - { - return input.size(); - } - - @Override - public ItemStack getRecipeOutput() - { - return output; - } - - @Override - public ItemStack getCraftingResult(InventoryCrafting var1) - { - return output.copy(); - } - - @SuppressWarnings("unchecked") - @Override - public boolean matches(InventoryCrafting var1, World world) - { - ArrayList required = new ArrayList(input); - - for (int x = 0; x < var1.getSizeInventory(); x++) - { - ItemStack slot = var1.getStackInSlot(x); - - if (slot != null) - { - boolean inRecipe = false; - Iterator req = required.iterator(); - - while (req.hasNext()) - { - boolean match = false; - - Object next = req.next(); - - //If target is integer, then we should be check the blood orb value of the item instead - if (next instanceof Integer) - { - if (slot != null && slot.getItem() instanceof IBloodOrb) - { - IBloodOrb orb = (IBloodOrb) slot.getItem(); - if (orb.getOrbLevel() < (Integer) next) - { - return false; - } - } else return false; - } else if (next instanceof ItemStack) - { - match = OreDictionary.itemMatches((ItemStack) next, slot, false); - } else if (next instanceof ArrayList) - { - Iterator itr = ((ArrayList) next).iterator(); - while (itr.hasNext() && !match) - { - match = OreDictionary.itemMatches(itr.next(), slot, false); - } - } - - if (match) - { - inRecipe = true; - required.remove(next); - break; - } - } - - if (!inRecipe) - { - return false; - } - } - } - - return required.isEmpty(); - } - - public ArrayList getInput() - { - return this.input; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java deleted file mode 100644 index 7fce7cd..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/ArmourUpgrade.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface ArmourUpgrade -{ - //Called when the armour ticks - public void onArmourUpdate(World world, EntityPlayer player, ItemStack thisItemStack); - - public boolean isUpgrade(); - - public int getEnergyForTenSeconds(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java deleted file mode 100644 index 46a7993..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBindable.java +++ /dev/null @@ -1,5 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -public interface IBindable -{ -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java deleted file mode 100644 index e88e9cc..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IBloodOrb.java +++ /dev/null @@ -1,8 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -public interface IBloodOrb -{ - public int getMaxEssence(); - - public int getOrbLevel(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java deleted file mode 100644 index 4150abe..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IHolding.java +++ /dev/null @@ -1,6 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -public interface IHolding -{ - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java b/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java deleted file mode 100644 index 23ac780..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/items/interfaces/IReagentManipulator.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.items.interfaces; - -/** - * Implement this interface to have reagent blocks return false on activating them, to allow manipulation of said block - */ -public interface IReagentManipulator -{ - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java b/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java deleted file mode 100644 index 7eea34c..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/renderer/MRSRenderer.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.alchemicalWizardry.api.renderer; - -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); - - protected void bindTexture(ResourceLocation p_147499_1_) - { - TextureManager texturemanager = TileEntityRendererDispatcher.instance.field_147553_e; - - if (texturemanager != null) - { - texturemanager.bindTexture(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 deleted file mode 100644 index 6704d97..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IMasterRitualStone.java +++ /dev/null @@ -1,40 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -import WayofTime.alchemicalWizardry.api.alchemy.energy.ISegmentedReagentHandler; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.World; - -public interface IMasterRitualStone extends ISegmentedReagentHandler -{ - public void performRitual(World world, int x, int y, int z, String ritualID); - - public String getOwner(); - - public void setCooldown(int newCooldown); - - public int getCooldown(); - - public void setVar1(int newVar1); - - public int getVar1(); - - public void setActive(boolean active); - - public int getDirection(); - - public World getWorld(); - - public int getXCoord(); - - public int getYCoord(); - - public int getZCoord(); - - public NBTTagCompound getCustomRitualTag(); - - public void setCustomRitualTag(NBTTagCompound tag); - - public boolean areTanksEmpty(); - - public int getRunningTime(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java deleted file mode 100644 index c2cec51..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/IRitualStone.java +++ /dev/null @@ -1,18 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -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); -} 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/RitualBreakMethod.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java deleted file mode 100644 index a705056..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualBreakMethod.java +++ /dev/null @@ -1,11 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -public enum RitualBreakMethod -{ - REDSTONE, - BREAK_MRS, - BREAK_STONE, - ACTIVATE, //When an activation crystal activates the MRS, overwriting the current ritual - DEACTIVATE, - EXPLOSION, //When the MRS is destroyed by an explosion -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java deleted file mode 100644 index 6e896e0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualComponent.java +++ /dev/null @@ -1,71 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -public class RitualComponent -{ - private int x; - private int y; - private int z; - private int stoneType; - public static final int BLANK = 0; - public static final int WATER = 1; - public static final int FIRE = 2; - public static final int EARTH = 3; - public static final int AIR = 4; - public static final int DUSK = 5; - - public RitualComponent(int x, int y, int z, int stoneType) - { - this.x = x; - this.y = y; - this.z = z; - this.stoneType = stoneType; - } - - public int getX() - { - return this.x; - } - - public int getY() - { - return this.y; - } - - public int getZ() - { - return this.z; - } - - public int getX(int direction) - { - switch(direction) - { - case 2: - return -this.getZ(); - case 3: - return -this.getX(); - case 4: - return this.getZ(); - default: return this.getX(); - } - } - - public int getZ(int direction) - { - switch(direction) - { - case 2: - return this.getX(); - case 3: - return -this.getZ(); - case 4: - return -this.getX(); - default: return this.getZ(); - } - } - - public int getStoneType() - { - return this.stoneType; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java deleted file mode 100644 index 498c803..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/RitualEffect.java +++ /dev/null @@ -1,56 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.alchemy.energy.Reagent; -import WayofTime.alchemicalWizardry.api.alchemy.energy.ReagentStack; - -public abstract class RitualEffect -{ - public abstract void performEffect(IMasterRitualStone ritualStone); - - public boolean startRitual(IMasterRitualStone ritualStone, EntityPlayer player) - { - return true; - } - - public void onRitualBroken(IMasterRitualStone ritualStone, RitualBreakMethod method) - { - - } - - public abstract int getCostPerRefresh(); - - public int getInitialCooldown() - { - return 0; - } - - public abstract List getRitualComponentList(); - - public boolean canDrainReagent(IMasterRitualStone ritualStone, Reagent reagent, int amount, boolean doDrain) - { - if (ritualStone == null || reagent == null || amount == 0) - { - return false; - } - - ReagentStack reagentStack = new ReagentStack(reagent, amount); - - ReagentStack stack = ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, false); - - if (stack != null && stack.amount >= amount) - { - if (doDrain) - { - ritualStone.drain(ForgeDirection.UNKNOWN, reagentStack, true); - } - - return true; - } - - return false; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java b/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java deleted file mode 100644 index 7609e82..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/rituals/Rituals.java +++ /dev/null @@ -1,377 +0,0 @@ -package WayofTime.alchemicalWizardry.api.rituals; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -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; -import WayofTime.alchemicalWizardry.api.event.RitualStopEvent; -import WayofTime.alchemicalWizardry.api.renderer.MRSRenderer; -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; - - public final MRSRenderer customRenderer; - - public static Map ritualMap = new HashMap(); - public static List keyList = new LinkedList(); - - public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) - { - this.crystalLevel = crystalLevel; - this.actCost = actCost; - this.effect = effect; - this.name = name; - keyList.add(name); - ritualMap.put(name, this); - this.customRenderer = renderer; - } - - public Rituals(int crystalLevel, int actCost, RitualEffect effect, String name) - { - this(crystalLevel, actCost, effect, name, null); - } - - /** - * Static method to register a ritual to the Ritual Registry - * - * @param key Unique identification key - must be different from all others to properly register - * @param crystalLevel Crystal level required to activate - * @param actCost LP amount required to activate - * @param effect The effect that will be ticked - * @param name The name of the ritual - * @return Returns true if properly registered, or false if the key is already used - */ - public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name, MRSRenderer renderer) - { - if (ritualMap.containsKey(key)) - { - return false; - } else - { - Rituals ritual = new Rituals(crystalLevel, actCost, effect, name, renderer); - ritual.removeRitualFromList(); - ritualMap.put(key, ritual); - keyList.add(key); - return true; - } - } - - public static boolean registerRitual(String key, int crystalLevel, int actCost, RitualEffect effect, String name) - { - if (ritualMap.containsKey(key)) - { - return false; - } else - { - Rituals ritual = new Rituals(crystalLevel, actCost, effect, name); - ritual.removeRitualFromList(); - ritualMap.put(key, ritual); - keyList.add(key); - return true; - } - } - - public void removeRitualFromList() - { - if (ritualMap.containsValue(this)) - { - ritualMap.remove(ritualMap.remove(this.name)); - } - if (keyList.contains(this.name)) - { - keyList.remove(this.name); - } - } - - public static String checkValidRitual(World world, int x, int y, int z) - { - for (String key : ritualMap.keySet()) - { - if (checkRitualIsValid(world, x, y, z, key)) - { - return key; - } - } - - return ""; - } - - public static boolean canCrystalActivate(String ritualID, int crystalLevel) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { - return ritual.getCrystalLevel() <= crystalLevel; - } - } - - return false; - } - - public static boolean checkRitualIsValid(World world, int x, int y, int z, String ritualID) - { - int direction = Rituals.getDirectionOfRitual(world, x, y, z, ritualID); - - if (direction != -1) - { - return true; - } - - return false; - } - - /** - * 1 - NORTH - * 2 - EAST - * 3 - SOUTH - * 4 - WEST - */ - public static boolean checkDirectionOfRitualValid(World world, int x, int y, int z, String ritualID, int direction) - { - List ritual = Rituals.getRitualList(ritualID); - - if (ritual == null) - { - return false; - } - - Block test = null; - TileEntity te = null; - - for (RitualComponent rc : ritual) - { - 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)); - - 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; - } - } - - return true; - } - - public static int getDirectionOfRitual(World world, int x, int y, int z, String ritualID) - { - for (int i = 1; i <= 4; i++) - { - if (Rituals.checkDirectionOfRitualValid(world, x, y, z, ritualID, i)) - { - return i; - } - } - - return -1; - } - - public static int getCostForActivation(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { - return ritual.actCost; - } - } - - return 0; - } - - public static int getInitialCooldown(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { - return ritual.effect.getInitialCooldown(); - } - } - - return 0; - } - - public static List getRitualList(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { - return ritual.obtainComponents(); - } else - { - return null; - } - } else - { - return null; - } - } - - private List obtainComponents() - { - return this.effect.getRitualComponentList(); - } - - private int getCrystalLevel() - { - return this.crystalLevel; - } - - private MRSRenderer getRenderer() - { - return this.customRenderer; - } - - public static void performEffect(IMasterRitualStone ritualStone, String ritualID) - { - String ownerName = ritualStone.getOwner(); - - RitualRunEvent event = new RitualRunEvent(ritualStone, ownerName, ritualID); - - if(MinecraftForge.EVENT_BUS.post(event) || event.getResult() == Event.Result.DENY) - { - return; - } - - if (ritualMap.containsKey(event.ritualKey)) - { - Rituals ritual = ritualMap.get(event.ritualKey); - if (ritual != null && ritual.effect != null) - { - ritual.effect.performEffect(ritualStone); - } - } - } - - public static boolean startRitual(IMasterRitualStone ritualStone, String ritualID, EntityPlayer player) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { - return ritual.effect.startRitual(ritualStone, player); - } - } - - return false; - } - - public static void onRitualBroken(IMasterRitualStone ritualStone, String ritualID, RitualBreakMethod method) - { - String ownerName = ritualStone.getOwner(); - RitualStopEvent event = new RitualStopEvent(ritualStone, ownerName, ritualID, method); - MinecraftForge.EVENT_BUS.post(event); - - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null && ritual.effect != null) - { - ritual.effect.onRitualBroken(ritualStone, method); - } - } - } - - public static int getNumberOfRituals() - { - return ritualMap.size(); - } - - public String getRitualName() - { - return this.name; - } - - public static String getNameOfRitual(String id) - { - if (ritualMap.containsKey(id)) - { - Rituals ritual = ritualMap.get(id); - if (ritual != null) - { - return ritual.getRitualName(); - } - } - - return ""; - } - - public static String getNextRitualKey(String key) - { - boolean hasSpotted = false; - String firstKey = ""; - - for (String str : keyList) - { - if (firstKey.equals("")) - { - firstKey = str; - } - if (hasSpotted) - { - return str; - } - if (str.equals(key)) - { - hasSpotted = true; - } - } - - return firstKey; - } - - public static String getPreviousRitualKey(String key) - { - boolean hasSpotted = false; - String lastKey = keyList.get(keyList.size() - 1); - - for (String str : keyList) - { - if (str.equals(key)) - { - hasSpotted = true; - } - if (hasSpotted) - { - return lastKey; - } - lastKey = str; - } - - return lastKey; - } - - public static MRSRenderer getRendererForKey(String ritualID) - { - if (ritualMap.containsKey(ritualID)) - { - Rituals ritual = ritualMap.get(ritualID); - if (ritual != null) - { - return ritual.getRenderer(); - } - } - - 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 deleted file mode 100644 index 91bcdaf..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/LifeEssenceNetwork.java +++ /dev/null @@ -1,30 +0,0 @@ -package WayofTime.alchemicalWizardry.api.soulNetwork; - -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 deleted file mode 100644 index e366ee6..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/soulNetwork/SoulNetworkHandler.java +++ /dev/null @@ -1,458 +0,0 @@ -package WayofTime.alchemicalWizardry.api.soulNetwork; - -import java.util.UUID; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.server.MinecraftServer; -import net.minecraft.util.DamageSource; -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 -{ - 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); - 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) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { - String ownerName = ist.getTagCompound().getString("ownerName"); - - return syphonFromNetwork(ownerName, damageToBeDone); - } - return 0; - } - - public static int syphonFromNetwork(String ownerName, int damageToBeDone) - { - 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); - } - - if (data.currentEssence >= damageToBeDone) - { - data.currentEssence -= damageToBeDone; - data.markDirty(); - return damageToBeDone; - } - - return 0; - } - - /** - * Master method used to syphon from the player's network, and will damage them accordingly if they do not have enough LP. - * Does not drain on the client side. - * - * @param ist Owned itemStack - * @param player Player using the item - * @param damageToBeDone - * @return True if the action should be executed and false if it should not. Always returns false if client-sided. - */ - public static boolean syphonAndDamageFromNetwork(ItemStack ist, EntityPlayer player, int drain) - { - if (player.worldObj.isRemote) - { - return false; - } - - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { - String ownerName = ist.getTagCompound().getString("ownerName"); - - ItemDrainNetworkEvent event = new ItemDrainNetworkEvent(player, ownerName, ist, drain); - - if(MinecraftForge.EVENT_BUS.post(event)) - { - return false; - } - - int drainAmount = syphonFromNetwork(event.ownerNetwork, event.drainAmount); - if(drainAmount == 0 || event.shouldDamage) - { - hurtPlayer(player, event.damageAmount); - } - - return (event.getResult() != Event.Result.DENY); //The event has been told to prevent the action but allow all repercussions of using the item. - } - - int amount = SoulNetworkHandler.syphonFromNetwork(ist, drain); - - hurtPlayer(player, drain - amount); - - return true; - } - - public static boolean syphonAndDamageFromNetwork(String ownerName, EntityPlayer player, int damageToBeDone) - { - if (player.worldObj.isRemote) - { - return false; - } - - World world = player.worldObj; - if (world != null) - { - double posX = player.posX; - double posY = player.posY; - double posZ = player.posZ; - - world.playSoundEffect((double) ((float) player.posX + 0.5F), (double) ((float) player.posY + 0.5F), (double) ((float) player.posZ + 0.5F), "random.fizz", 0.5F, 2.6F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.8F); - } - - int amount = SoulNetworkHandler.syphonFromNetwork(ownerName, damageToBeDone); - - hurtPlayer(player, damageToBeDone - amount); - - return true; - } - - public static boolean canSyphonFromOnlyNetwork(ItemStack ist, int damageToBeDone) - { - if (ist.getTagCompound() != null && !(ist.getTagCompound().getString("ownerName").equals(""))) - { - String ownerName = ist.getTagCompound().getString("ownerName"); - - return canSyphonFromOnlyNetwork(ownerName, damageToBeDone); - } - - return false; - } - - public static boolean canSyphonFromOnlyNetwork(String ownerName, int damageToBeDone) - { - if (MinecraftServer.getServer() == null) - { - return false; - } - - 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.currentEssence >= damageToBeDone; - } - - public static int getCurrentEssence(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.currentEssence; - } - - public static void setCurrentEssence(String ownerName, int essence) - { - 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.currentEssence = essence; - data.markDirty(); - } - - /** - * A method to add to an owner's network up to a maximum value. - * - * @param ownerName - * @param addedEssence - * @param maximum - * @return amount added to the network - */ - public static int addCurrentEssenceToMaximum(String ownerName, int addedEssence, int maximum) - { - AddToNetworkEvent event = new AddToNetworkEvent(ownerName, addedEssence, maximum); - - if(MinecraftForge.EVENT_BUS.post(event)) - { - return 0; - } - - if (MinecraftServer.getServer() == null) - { - return 0; - } - - World world = MinecraftServer.getServer().worldServers[0]; - LifeEssenceNetwork data = (LifeEssenceNetwork) world.loadItemData(LifeEssenceNetwork.class, event.ownerNetwork); - - if (data == null) - { - data = new LifeEssenceNetwork(event.ownerNetwork); - world.setItemData(event.ownerNetwork, data); - } - - int currEss = data.currentEssence; - - if (currEss >= event.maximum) - { - return 0; - } - - int newEss = Math.min(event.maximum, currEss + event.addedAmount); - if(event.getResult() != Event.Result.DENY) - { - data.currentEssence = newEss; - } - - return newEss - currEss; - } - - public static void hurtPlayer(EntityPlayer user, int energySyphoned) - { - if (energySyphoned < 100 && energySyphoned > 0) - { - if (!user.capabilities.isCreativeMode) - { - user.setHealth((user.getHealth() - 1)); - - if (user.getHealth() <= 0.0005f) - { - user.onDeath(DamageSource.generic); - } - } - } else if (energySyphoned >= 100) - { - if (!user.capabilities.isCreativeMode) - { - for (int i = 0; i < ((energySyphoned + 99) / 100); i++) - { - user.setHealth((user.getHealth() - 1)); - - if (user.getHealth() <= 0.0005f) - { - user.onDeath(DamageSource.generic); - break; - } - } - } - } - } - - public static void hurtPlayer(EntityPlayer user, float damage) - { - if (!user.capabilities.isCreativeMode) - { - user.setHealth((user.getHealth() - damage)); - - if (user.getHealth() <= 0.0005f) - { - user.onDeath(DamageSource.generic); - } - } - } - - public static void checkAndSetItemOwner(ItemStack item, EntityPlayer player) - { - if (item.stackTagCompound == null) - { - item.setTagCompound(new NBTTagCompound()); - } - - if (item.stackTagCompound.getString("ownerName").equals("")) - { - 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); - } - } - - public static String getUsername(EntityPlayer player) - { - return player.getDisplayName(); - } - - public static EntityPlayer getPlayerForUsername(String str) - { - if (MinecraftServer.getServer() == null) - { - return null; - } - return MinecraftServer.getServer().getConfigurationManager().func_152612_a(str); - } - - public static void causeNauseaToPlayer(ItemStack stack) - { - if (stack.getTagCompound() != null && !(stack.getTagCompound().getString("ownerName").equals(""))) - { - String ownerName = stack.getTagCompound().getString("ownerName"); - - SoulNetworkHandler.causeNauseaToPlayer(ownerName); - } - } - - public static void causeNauseaToPlayer(String ownerName) - { - EntityPlayer entityOwner = SoulNetworkHandler.getPlayerForUsername(ownerName); - - if (entityOwner == null) - { - return; - } - - entityOwner.addPotionEffect(new PotionEffect(Potion.confusion.id, 80)); - } - - public static String getOwnerName(ItemStack item) - { - if (item.stackTagCompound == null) - { - item.setTagCompound(new NBTTagCompound()); - } - - 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 deleted file mode 100644 index ce40bd4..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/APISpellHelper.java +++ /dev/null @@ -1,228 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.block.Block; -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.ItemStack; -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; - -public class APISpellHelper -{ - public static int getPlayerLPTag(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:StoredLP")) - { - return data.getInteger("BM:StoredLP"); - } - - return 0; - } - - public static void setPlayerLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = player.getEntityData(); - data.setInteger("BM:StoredLP", amount); - } - - public static int getPlayerMaxLPTag(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:MaxStoredLP")) - { - return data.getInteger("BM:MaxStoredLP"); - } - - return 0; - } - - public static void setPlayerMaxLPTag(EntityPlayer player, int amount) - { - NBTTagCompound data = player.getEntityData(); - data.setInteger("BM:MaxStoredLP", amount); - } - - public static float getPlayerCurrentReagentAmount(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:StoredReagentAmount")) - { - return data.getFloat("BM:StoredReagentAmount"); - } - - return 0; - } - - public static void setPlayerCurrentReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:StoredReagentAmount", amount); - } - - public static float getPlayerMaxReagentAmount(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:MaxReagentAmount")) - { - return data.getFloat("BM:MaxReagentAmount"); - } - - return 0; - } - - public static void setPlayerMaxReagentAmount(EntityPlayer player, float amount) - { - NBTTagCompound data = player.getEntityData(); - data.setFloat("BM:MaxReagentAmount", amount); - } - - public static Reagent getPlayerReagentType(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:ReagentType")) - { - return ReagentRegistry.getReagentForKey(data.getString("BM:ReagentType")); - } - - return null; - } - - public static void setPlayerReagentType(EntityPlayer player, String str) - { - NBTTagCompound data = player.getEntityData(); - data.setString("BM:ReagentType", str); - } - - public static void setPlayerReagentType(EntityPlayer player, Reagent reagent) - { - setPlayerReagentType(player, ReagentRegistry.getKeyForReagent(reagent)); - } - - public static int getCurrentAdditionalHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:CurrentAddedHP")) - { - return data.getInteger("BM:CurrentAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalHP(EntityPlayer player, int amount) - { - NBTTagCompound data = player.getEntityData(); - data.setInteger("BM:CurrentAddedHP", amount); - } - - public static int getCurrentAdditionalMaxHP(EntityPlayer player) - { - NBTTagCompound data = player.getEntityData(); - if(data.hasKey("BM:MaxAddedHP")) - { - return data.getInteger("BM:MaxAddedHP"); - } - - return 0; - } - - public static void setCurrentAdditionalMaxHP(EntityPlayer player, int amount) - { - NBTTagCompound data = player.getEntityData(); - data.setInteger("BM:MaxAddedHP", amount); - } - - public static MovingObjectPosition raytraceFromEntity(World world, Entity player, boolean par3, double range) - { - float f = 1.0F; - float f1 = player.prevRotationPitch + (player.rotationPitch - player.prevRotationPitch) * f; - float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f; - double d0 = player.prevPosX + (player.posX - player.prevPosX) * (double) f; - double d1 = player.prevPosY + (player.posY - player.prevPosY) * (double) f; - if (!world.isRemote && player instanceof EntityPlayer) - d1 += 1.62D; - double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * (double) f; - 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); - float f6 = MathHelper.sin(-f1 * 0.017453292F); - float f7 = f4 * f5; - float f8 = f3 * f5; - double d3 = range; - if (player instanceof EntityPlayerMP) - { -// 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 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); - - if (canSilk && silkTouch) - { - ArrayList items = new ArrayList(); - ItemStack item = new ItemStack(block, 1, meta); - - items.add(item); - - return items; - } else - { - return block.getDrops(world, x, y, z, meta, fortune); - } - } - - public static void spawnItemListInWorld(List items, World world, float x, float y, float z) - { - for (ItemStack stack : items) - { - EntityItem itemEntity = new EntityItem(world, x, y, z, stack); - itemEntity.delayBeforeCanPickup = 10; - world.spawnEntityInWorld(itemEntity); - } - } - - public static String getNumeralForInt(int num) - { - switch (num) - { - case 1: - return "I"; - case 2: - return "II"; - case 3: - return "III"; - case 4: - return "IV"; - case 5: - return "V"; - case 6: - return "VI"; - case 7: - return "VII"; - case 8: - return "VIII"; - case 9: - return "IX"; - case 10: - return "X"; - default: - return ""; - } - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java deleted file mode 100644 index 26bcfc2..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellEffect.java +++ /dev/null @@ -1,92 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - - -public abstract class ComplexSpellEffect -{ - public final ComplexSpellType type; - public final ComplexSpellModifier modifier; - - protected int powerEnhancement; - protected int costEnhancement; - protected int potencyEnhancement; - - public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) - { - this.type = type; - this.modifier = modifier; - } - - public ComplexSpellEffect(ComplexSpellType type, ComplexSpellModifier modifier, int power, int cost, int potency) - { - this(type, modifier); - - this.powerEnhancement = power; - this.costEnhancement = cost; - this.potencyEnhancement = potency; - } - - public abstract void modifyParadigm(SpellParadigm parad); - - public ComplexSpellType getType() - { - return this.type; - } - - public ComplexSpellModifier getModifier() - { - return this.modifier; - } - - public abstract ComplexSpellEffect copy(int power, int cost, int potency); - - public abstract int getCostOfEffect(); - -// public NBTTagCompound getTag() -// { -// NBTTagCompound tag = new NBTTagCompound(); -// -// tag.setString("Class", this.getClass().getName()); -// tag.setInteger("modifier", modifierState); -// tag.setInteger("power", powerEnhancement); -// tag.setInteger("cost", costEnhancement); -// tag.setInteger("potency", potencyEnhancement); -// -// return tag; -// } -// -// public static SpellEffect getEffectFromTag(NBTTagCompound tag) -// { -// try -// { -// Class clazz = Class.forName(tag.getString("Class")); -// if (clazz != null) -// { -// try -// { -// Object obj = clazz.newInstance(); -// if (obj instanceof SpellEffect) -// { -// SpellEffect eff = (SpellEffect) obj; -// -// eff.modifierState = tag.getInteger("modifier"); -// eff.powerEnhancement = tag.getInteger("power"); -// eff.costEnhancement = tag.getInteger("cost"); -// eff.potencyEnhancement = tag.getInteger("potency"); -// -// return eff; -// } -// } catch (InstantiationException e) -// { -// e.printStackTrace(); -// } catch (IllegalAccessException e) -// { -// e.printStackTrace(); -// } -// } -// } catch (ClassNotFoundException e) -// { -// e.printStackTrace(); -// } -// return null; -// } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java deleted file mode 100644 index 537a5e2..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellModifier.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class ComplexSpellModifier -{ - public static ComplexSpellModifier DEFAULT = new ComplexSpellModifier(); - public static ComplexSpellModifier OFFENSIVE = new ComplexSpellModifier(); - public static ComplexSpellModifier DEFENSIVE = new ComplexSpellModifier(); - public static ComplexSpellModifier ENVIRONMENTAL = new ComplexSpellModifier(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java deleted file mode 100644 index 1c308a8..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ComplexSpellType.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class ComplexSpellType -{ - public static ComplexSpellType FIRE = new ComplexSpellType(); - public static ComplexSpellType ICE = new ComplexSpellType(); - public static ComplexSpellType EARTH = new ComplexSpellType(); - public static ComplexSpellType WIND = new ComplexSpellType(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java deleted file mode 100644 index becdb32..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/EntitySpellProjectile.java +++ /dev/null @@ -1,650 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -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.*; -import net.minecraft.world.World; -import net.minecraftforge.common.util.Constants; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; - -public class EntitySpellProjectile extends Entity implements IProjectile -{ - private int xTile = -1; - private int yTile = -1; - private int zTile = -1; - private int inTile = 0; - private int inData = 0; - private boolean inGround = false; - /** - * The owner of this arrow. - */ - public EntityPlayer shootingEntity; - private int ticksInAir = 0; - private int ricochetCounter = 0; - private boolean scheduledForDeath = false; - private boolean isSilkTouch = false; - - //Custom variables - private int maxRicochet = 0; - private float damage = 1; - public List impactList = new ArrayList(); - private boolean penetration = false; - public List updateEffectList = new ArrayList(); - public List spellEffectList = new LinkedList(); - private int blocksBroken = 0; - - public EntitySpellProjectile(World par1World) - { - super(par1World); - this.setSize(0.5F, 0.5F); - } - - public EntitySpellProjectile(World par1World, double par2, double par4, double par6) - { - super(par1World); - this.setSize(0.5F, 0.5F); - this.setPosition(par2, par4, par6); - yOffset = 0.0F; - } - - public EntitySpellProjectile(World par1World, EntityPlayer par2EntityPlayer) - { - super(par1World); - shootingEntity = par2EntityPlayer; - float par3 = 0.8F; - this.setSize(0.1F, 0.1F); - this.setLocationAndAngles(par2EntityPlayer.posX, par2EntityPlayer.posY + par2EntityPlayer.getEyeHeight(), par2EntityPlayer.posZ, par2EntityPlayer.rotationYaw, par2EntityPlayer.rotationPitch); - posX -= MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - posY -= 0.2D; - posZ -= MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * 0.16F; - this.setPosition(posX, posY, posZ); - yOffset = 0.0F; - motionX = -MathHelper.sin(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionZ = MathHelper.cos(rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(rotationPitch / 180.0F * (float) Math.PI); - motionY = -MathHelper.sin(rotationPitch / 180.0F * (float) Math.PI); - this.setThrowableHeading(motionX, motionY, motionZ, par3 * 1.5F, 1.0F); - - } - - @Override - protected void entityInit() - { - dataWatcher.addObject(16, Byte.valueOf((byte) 0)); - } - - /** - * Similar to setArrowHeading, it's point the throwable entity to a x, y, z - * direction. - */ - @Override - public void setThrowableHeading(double var1, double var3, double var5, float var7, float var8) - { - float var9 = MathHelper.sqrt_double(var1 * var1 + var3 * var3 + var5 * var5); - var1 /= var9; - var3 /= var9; - var5 /= var9; - var1 += rand.nextGaussian() * 0.007499999832361937D * var8; - var3 += rand.nextGaussian() * 0.007499999832361937D * var8; - var5 += rand.nextGaussian() * 0.007499999832361937D * var8; - var1 *= var7; - var3 *= var7; - var5 *= var7; - motionX = var1; - motionY = var3; - motionZ = var5; - float var10 = MathHelper.sqrt_double(var1 * var1 + var5 * var5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(var1, var5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(var3, var10) * 180.0D / Math.PI); - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Sets the position and rotation. Only difference from the other one is no bounding on the rotation. Args: posX, - * posY, posZ, yaw, pitch - */ - public void setPositionAndRotation2(double par1, double par3, double par5, float par7, float par8, int par9) - { - this.setPosition(par1, par3, par5); - this.setRotation(par7, par8); - } - - @Override - @SideOnly(Side.CLIENT) - /** - * Sets the velocity to the args. Args: x, y, z - */ - public void setVelocity(double par1, double par3, double par5) - { - motionX = par1; - motionY = par3; - motionZ = par5; - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { - float var7 = MathHelper.sqrt_double(par1 * par1 + par5 * par5); - prevRotationYaw = rotationYaw = (float) (Math.atan2(par1, par5) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(par3, var7) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch; - prevRotationYaw = rotationYaw; - this.setLocationAndAngles(posX, posY, posZ, rotationYaw, rotationPitch); - } - } - - /** - * Called to update the entity's position/logic. - */ - @Override - public void onUpdate() - { - super.onUpdate(); - this.performUpdateEffects(); - if (ticksInAir > 600) - { - this.setDead(); - } - if (shootingEntity == null) - { - List players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(posX - 1, posY - 1, posZ - 1, posX + 1, posY + 1, posZ + 1)); - Iterator i = players.iterator(); - double closestDistance = Double.MAX_VALUE; - EntityPlayer closestPlayer = null; - while (i.hasNext()) - { - EntityPlayer e = (EntityPlayer) i.next(); - double distance = e.getDistanceToEntity(this); - if (distance < closestDistance) - { - closestPlayer = e; - } - } - if (closestPlayer != null) - { - shootingEntity = closestPlayer; - } - } - if (prevRotationPitch == 0.0F && prevRotationYaw == 0.0F) - { - float var1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - prevRotationYaw = rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI); - prevRotationPitch = rotationPitch = (float) (Math.atan2(motionY, var1) * 180.0D / Math.PI); - } - Block var16 = worldObj.getBlock(xTile, yTile, zTile); - - if (var16 != null) - { - var16.setBlockBoundsBasedOnState(worldObj, xTile, yTile, zTile); - AxisAlignedBB var2 = var16.getCollisionBoundingBoxFromPool(worldObj, xTile, yTile, zTile); - - if (var2 != null && var2.isVecInside(Vec3.createVectorHelper(posX, posY, posZ))) - { - inGround = true; - } - } - - if (inGround) - { - Block var18 = worldObj.getBlock(xTile, yTile, zTile); - int var19 = worldObj.getBlockMetadata(xTile, yTile, zTile); - - if (var18.equals(Block.getBlockById(inTile)) && var19 == inData) - { - // this.groundImpact(); - // this.setDead(); - } - } else - { - ++ticksInAir; - - if (ticksInAir > 1 && ticksInAir < 3) - { - //worldObj.spawnParticle("flame", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0D, 0D, 0D); - for (int particles = 0; particles < 3; particles++) - { - this.doFiringParticles(); - } - } - - 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 = Vec3.createVectorHelper(posX, posY, posZ); - var3 = Vec3.createVectorHelper(posX + motionX, posY + motionY, posZ + motionZ); - - if (var4 != null) - { - var3 = Vec3.createVectorHelper(var4.hitVec.xCoord, var4.hitVec.yCoord, var4.hitVec.zCoord); - } - - Entity var5 = null; - List var6 = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D)); - double var7 = 0.0D; - Iterator var9 = var6.iterator(); - float var11; - - while (var9.hasNext()) - { - Entity var10 = (Entity) var9.next(); - - if (var10.canBeCollidedWith() && (var10 != shootingEntity || ticksInAir >= 5)) - { - var11 = 0.3F; - AxisAlignedBB var12 = var10.boundingBox.expand(var11, var11, var11); - MovingObjectPosition var13 = var12.calculateIntercept(var17, var3); - - if (var13 != null) - { - double var14 = var17.distanceTo(var13.hitVec); - - if (var14 < var7 || var7 == 0.0D) - { - var5 = var10; - var7 = var14; - } - } - } - } - - if (var5 != null) - { - var4 = new MovingObjectPosition(var5); - } - - if (var4 != null) - { - this.onImpact(var4); - - if (scheduledForDeath) - { - this.setDead(); - } - } - - posX += motionX; - posY += motionY; - posZ += motionZ; - MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ); - this.setPosition(posX, posY, posZ); - //this.doBlockCollisions(); - } - } - - private void doFlightParticles() - { - if (ticksInAir % 3 == 0) - { - double gauss = gaussian(1.0F); - worldObj.spawnParticle("mobSpell", posX, posY, posZ, gauss, gauss, 0.0F); - } - } - - private void doFiringParticles() - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), 0.5D, 0.5D, 0.5D); - worldObj.spawnParticle("flame", posX, posY, posZ, gaussian(motionX), gaussian(motionY), gaussian(motionZ)); - } - - /** - * (abstract) Protected helper method to write subclass entity data to NBT. - */ - @Override - public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) - { - par1NBTTagCompound.setShort("xTile", (short) xTile); - par1NBTTagCompound.setShort("yTile", (short) yTile); - par1NBTTagCompound.setShort("zTile", (short) zTile); - par1NBTTagCompound.setByte("inTile", (byte) inTile); - par1NBTTagCompound.setByte("inData", (byte) inData); - par1NBTTagCompound.setByte("inGround", (byte) (inGround ? 1 : 0)); - - NBTTagList effectList = new NBTTagList(); - - for (SpellEffect eff : spellEffectList) - { - effectList.appendTag(eff.getTag()); - } - -// for (String str : this.effectList) -// { -// if (str != null) -// { -// NBTTagCompound tag = new NBTTagCompound(); -// -// tag.setString("Class", str); -// effectList.appendTag(tag); -// } -// } - - par1NBTTagCompound.setTag("Effects", effectList); - par1NBTTagCompound.setInteger("blocksBroken", blocksBroken); - par1NBTTagCompound.setBoolean("isSilkTouch", isSilkTouch); - } - - /** - * (abstract) Protected helper method to read subclass entity data from NBT. - */ - @Override - public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) - { - xTile = par1NBTTagCompound.getShort("xTile"); - yTile = par1NBTTagCompound.getShort("yTile"); - zTile = par1NBTTagCompound.getShort("zTile"); - inTile = par1NBTTagCompound.getByte("inTile") & 255; - inData = par1NBTTagCompound.getByte("inData") & 255; - inGround = par1NBTTagCompound.getByte("inGround") == 1; - blocksBroken = par1NBTTagCompound.getInteger("blocksBroken"); - isSilkTouch = par1NBTTagCompound.getBoolean("isSilkTouch"); - - NBTTagList tagList = par1NBTTagCompound.getTagList("Effects", Constants.NBT.TAG_COMPOUND); - - List spellEffectList = new LinkedList(); - for (int i = 0; i < tagList.tagCount(); i++) - { - NBTTagCompound tag = (NBTTagCompound) tagList.getCompoundTagAt(i); - - SpellEffect eff = SpellEffect.getEffectFromTag(tag); - if (eff != null) - { - spellEffectList.add(eff); - } - } - this.spellEffectList = spellEffectList; - - -// this.effectList = new LinkedList(); -// for (int i = 0; i < tagList.tagCount(); i++) -// { -// NBTTagCompound tag = (NBTTagCompound) tagList.tagAt(i); -// -// this.effectList.add(tag.getString("Class")); -// } - - //SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForStringArray(effectList); - SpellParadigmProjectile parad = SpellParadigmProjectile.getParadigmForEffectArray(spellEffectList); - parad.applyAllSpellEffects(); - parad.prepareProjectile(this); - } - - /** - * returns if this entity triggers Block.onEntityWalking on the blocks they - * walk on. used for spiders and wolves to prevent them from trampling crops - */ - @Override - protected boolean canTriggerWalking() - { - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public float getShadowSize() - { - return 0.0F; - } - - /** - * Sets the amount of knockback the arrow applies when it hits a mob. - */ - public void setKnockbackStrength(int par1) - { - } - - /** - * If returns false, the item will not inflict any damage against entities. - */ - @Override - public boolean canAttackWithItem() - { - return false; - } - - /** - * Whether the arrow has a stream of critical hit particles flying behind - * it. - */ - public void setIsCritical(boolean par1) - { - byte var2 = dataWatcher.getWatchableObjectByte(16); - if (par1) - { - dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 | 1))); - } else - { - dataWatcher.updateObject(16, Byte.valueOf((byte) (var2 & -2))); - } - } - - /** - * Whether the arrow has a stream of critical hit particles flying behind - * it. - */ - public boolean getIsCritical() - { - byte var1 = dataWatcher.getWatchableObjectByte(16); - return (var1 & 1) != 0; - } - - private void onImpact(MovingObjectPosition mop) - { - if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.ENTITY && mop.entityHit != null) - { - if (mop.entityHit == shootingEntity) return; - this.onImpact(mop.entityHit); - this.performEntityImpactEffects(mop.entityHit); - } else if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) - { - if (!this.penetration) - { - this.groundImpact(mop.sideHit); - this.performTileImpactEffects(mop); - } - } - } - - private void onImpact(Entity mop) //TODO - { - if (mop == shootingEntity && ticksInAir > 3) - { - shootingEntity.attackEntityFrom(DamageSource.causePlayerDamage(shootingEntity), 1); - this.setDead(); - } else - { - doDamage(this.damage, mop); - } - spawnHitParticles("exorcism", 8); - this.setDead(); - } - - - private void spawnHitParticles(String string, int i) - { - for (int particles = 0; particles < i; particles++) - { - worldObj.spawnParticle("mobSpellAmbient", posX + smallGauss(0.1D), posY + smallGauss(0.1D), posZ + smallGauss(0.1D), posGauss(1.0F), posGauss(1.0F), 0.0F); - } - } - - private void doDamage(float f, Entity mop) - { - mop.attackEntityFrom(this.getDamageSource(), f); - } - - private DamageSource getDamageSource() - { - return DamageSource.causePlayerDamage(shootingEntity); - } - - private void groundImpact(int sideHit) - { - this.ricochet(sideHit); - } - - private double smallGauss(double d) - { - return (worldObj.rand.nextFloat() - 0.5D) * d; - } - - private double posGauss(double d) - { - return rand.nextFloat() * 0.5D * d; - } - - private double gaussian(double d) - { - return d + d * ((rand.nextFloat() - 0.5D) / 4); - } - - private void ricochet(int sideHit) - { - switch (sideHit) - { - case 0: - case 1: - // topHit, bottomHit, reflect Y - motionY = motionY * -1; - break; - case 2: - case 3: - // westHit, eastHit, reflect Z - motionZ = motionZ * -1; - break; - case 4: - case 5: - // southHit, northHit, reflect X - motionX = motionX * -1; - break; - } - ricochetCounter++; - if (ricochetCounter > this.getRicochetMax()) - { - scheduledForDeath = true; - for (int particles = 0; particles < 4; particles++) - { - switch (sideHit) - { - case 0: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), -gaussian(0.1D), gaussian(0.1D)); - break; - case 1: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); - break; - case 2: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), -gaussian(0.1D)); - break; - case 3: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); - break; - case 4: - worldObj.spawnParticle("smoke", posX, posY, posZ, -gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); - break; - case 5: - worldObj.spawnParticle("smoke", posX, posY, posZ, gaussian(0.1D), gaussian(0.1D), gaussian(0.1D)); - break; - } - } - } - } - - //Custom stuff - public int getRicochetMax() - { - return this.maxRicochet; - } - - public void setRicochetMax(int ricochet) - { - this.maxRicochet = ricochet; - } - - public void setImpactList(List list) - { - this.impactList = list; - } - - public void setUpdateEffectList(List list) - { - this.updateEffectList = list; - } - - private void performEntityImpactEffects(Entity mop) - { - if (impactList != null) - { - for (IProjectileImpactEffect impactEffect : impactList) - { - impactEffect.onEntityImpact(mop, this); - } - } - } - - private void performTileImpactEffects(MovingObjectPosition mop) - { - if (impactList != null) - { - for (IProjectileImpactEffect impactEffect : impactList) - { - impactEffect.onTileImpact(worldObj, mop); - } - } - } - - private void performUpdateEffects() - { - if (updateEffectList != null) - { - for (IProjectileUpdateEffect updateEffect : updateEffectList) - { - updateEffect.onUpdateEffect(this); - } - } - } - - public void setPenetration(boolean penetration) - { - this.penetration = penetration; - } - - public float getDamage() - { - return this.damage; - } - - public void setDamage(float damage) - { - this.damage = damage; - } - - public void setSpellEffectList(List list) - { - this.spellEffectList = list; - } - - public int getBlocksBroken() - { - return this.blocksBroken; - } - - public void setBlocksBroken(int blocksBroken) - { - this.blocksBroken = blocksBroken; - } - - public boolean getIsSilkTouch() - { - return this.isSilkTouch; - } - - public void setIsSilkTouch(boolean bool) - { - this.isSilkTouch = bool; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java deleted file mode 100644 index 0392937..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ExtrapolatedMeleeEntityEffect.java +++ /dev/null @@ -1,72 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -import java.util.List; - -public abstract class ExtrapolatedMeleeEntityEffect implements IMeleeSpellEntityEffect -{ - protected float range; - protected float radius; - protected int powerUpgrades; - protected int potencyUpgrades; - protected int costUpgrades; - protected int maxHit; - - public ExtrapolatedMeleeEntityEffect(int power, int potency, int cost) - { - this.powerUpgrades = power; - this.potencyUpgrades = potency; - this.costUpgrades = cost; - this.range = 0; - this.radius = 0; - this.maxHit = 1; - } - - @Override - public void onEntityImpact(World world, EntityPlayer entityPlayer) - { - Vec3 lookVec = entityPlayer.getLook(range); - double x = entityPlayer.posX + lookVec.xCoord; - double y = entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord; - double z = entityPlayer.posZ + lookVec.zCoord; - - List entities = world.getEntitiesWithinAABB(Entity.class, AxisAlignedBB.getBoundingBox(x - 0.5f, y - 0.5f, z - 0.5f, x + 0.5f, y + 0.5f, z + 0.5f).expand(radius, radius, radius)); - int hit = 0; - - if (entities != null) - { - for (Entity entity : entities) - { - if (hit < maxHit && !entity.equals(entityPlayer)) - { - if (this.entityEffect(world, entity, entityPlayer)) - { - hit++; - } - } - } - } - } - - protected abstract boolean entityEffect(World world, Entity entity, EntityPlayer player); - - public void setRange(float range) - { - this.range = range; - } - - public void setRadius(float radius) - { - this.radius = radius; - } - - public void setMaxNumberHit(int maxHit) - { - this.maxHit = maxHit; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java deleted file mode 100644 index 2355ed7..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IDigAreaEffect.java +++ /dev/null @@ -1,12 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -public interface IDigAreaEffect -{ - public abstract int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java deleted file mode 100644 index eb9b766..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IItemManipulator.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.item.ItemStack; - -import java.util.List; - -public interface IItemManipulator -{ - public List handleItemsOnBlockBroken(ItemStack toolStack, List itemList); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java deleted file mode 100644 index 65f53f8..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ILeftClickEffect.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; - -public interface ILeftClickEffect -{ - public abstract int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java deleted file mode 100644 index 6b5d7ef..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellEntityEffect.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public interface IMeleeSpellEntityEffect -{ - public void onEntityImpact(World world, EntityPlayer entityPlayer); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java deleted file mode 100644 index b0560cf..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IMeleeSpellWorldEffect.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public interface IMeleeSpellWorldEffect -{ - public void onWorldEffect(World world, EntityPlayer entityPlayer); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java deleted file mode 100644 index 4e12fdd..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBanishTool.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IOnBanishTool -{ - public abstract int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java deleted file mode 100644 index 12f844c..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnBreakBlock.java +++ /dev/null @@ -1,12 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; - -public interface IOnBreakBlock -{ - public abstract int onBlockBroken(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java deleted file mode 100644 index 6a5ea4d..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IOnSummonTool.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IOnSummonTool -{ - public abstract int onSummonTool(ItemStack toolStack, World world, Entity entity); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java deleted file mode 100644 index c534823..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileImpactEffect.java +++ /dev/null @@ -1,12 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -public interface IProjectileImpactEffect -{ - public void onEntityImpact(Entity mop, Entity projectile); - - public void onTileImpact(World world, MovingObjectPosition mop); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java deleted file mode 100644 index e973538..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IProjectileUpdateEffect.java +++ /dev/null @@ -1,8 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; - -public interface IProjectileUpdateEffect -{ - public void onUpdateEffect(Entity projectile); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java deleted file mode 100644 index dd9f7d2..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IRightClickEffect.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; - -public interface IRightClickEffect -{ - //public abstract int onRightClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder); - - public abstract int onRightClickBlock(ItemStack stack, EntityLivingBase weilder, World world, MovingObjectPosition mop); - - public abstract int onRightClickAir(ItemStack stack, EntityLivingBase weilder); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java deleted file mode 100644 index c49edaf..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISelfSpellEffect.java +++ /dev/null @@ -1,9 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public interface ISelfSpellEffect -{ - public void onSelfUse(World world, EntityPlayer player); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java deleted file mode 100644 index 323ccf3..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ISpecialDamageEffect.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; - -public interface ISpecialDamageEffect -{ - public float getDamageForEntity(Entity entity); - - public String getKey(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java deleted file mode 100644 index c3bacfc..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/IToolUpdateEffect.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.Entity; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface IToolUpdateEffect -{ - public abstract int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java deleted file mode 100644 index 68ec013..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellCenteredWorldEffect.java +++ /dev/null @@ -1,33 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.Vec3; -import net.minecraft.world.World; - -public abstract class MeleeSpellCenteredWorldEffect extends MeleeSpellWorldEffect -{ - protected float range; - - public MeleeSpellCenteredWorldEffect(int power, int potency, int cost) - { - super(power, potency, cost); - } - - @Override - public void onWorldEffect(World world, EntityPlayer entityPlayer) - { - Vec3 lookVec = entityPlayer.getLook(range).normalize(); - int x = (int) (entityPlayer.posX + lookVec.xCoord * range); - int y = (int) (entityPlayer.posY + entityPlayer.getEyeHeight() + lookVec.yCoord * range); - int z = (int) (entityPlayer.posZ + lookVec.zCoord * range); - - this.onCenteredWorldEffect(entityPlayer, world, x, y, z); - } - - public void setRange(float range) - { - this.range = range; - } - - public abstract void onCenteredWorldEffect(EntityPlayer player, World world, int posX, int posY, int posZ); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java deleted file mode 100644 index 844b540..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/MeleeSpellWorldEffect.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.world.World; - -public abstract class MeleeSpellWorldEffect implements IMeleeSpellWorldEffect -{ - protected int powerUpgrades; - protected int potencyUpgrades; - protected int costUpgrades; - - public MeleeSpellWorldEffect(int power, int potency, int cost) - { - this.powerUpgrades = power; - this.potencyUpgrades = potency; - this.costUpgrades = cost; - } - - @Override - public abstract void onWorldEffect(World world, EntityPlayer entityPlayer); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java deleted file mode 100644 index 22ef5db..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileImpactEffect.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public abstract class ProjectileImpactEffect implements IProjectileImpactEffect -{ - protected int powerUpgrades; - protected int potencyUpgrades; - protected int costUpgrades; - - public ProjectileImpactEffect(int power, int potency, int cost) - { - this.powerUpgrades = power; - this.potencyUpgrades = potency; - this.costUpgrades = cost; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java deleted file mode 100644 index 500e7cf..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/ProjectileUpdateEffect.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public abstract class ProjectileUpdateEffect implements IProjectileUpdateEffect -{ - protected int powerUpgrades; - protected int potencyUpgrades; - protected int costUpgrades; - - public ProjectileUpdateEffect(int power, int potency, int cost) - { - this.powerUpgrades = power; - this.potencyUpgrades = potency; - this.costUpgrades = cost; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java deleted file mode 100644 index 5e9e356..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SelfSpellEffect.java +++ /dev/null @@ -1,15 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public abstract class SelfSpellEffect implements ISelfSpellEffect -{ - protected int powerUpgrades; - protected int potencyUpgrades; - protected int costUpgrades; - - public SelfSpellEffect(int power, int potency, int cost) - { - this.powerUpgrades = power; - this.potencyUpgrades = potency; - this.costUpgrades = cost; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java deleted file mode 100644 index 1ae52ba..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffect.java +++ /dev/null @@ -1,500 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import net.minecraft.nbt.NBTTagCompound; - -/** - * New wrapper class to enclose the ComplexSpellEffect - */ -public class SpellEffect -{ - public ComplexSpellType type; - public ComplexSpellModifier modifier; - - protected int powerEnhancement; - protected int costEnhancement; - protected int potencyEnhancement; - - public SpellEffect() - { - this(ComplexSpellType.FIRE); - } - - public SpellEffect(ComplexSpellType type) - { - this(type, ComplexSpellModifier.DEFAULT); - } - - public SpellEffect(ComplexSpellType type, ComplexSpellModifier modifier) - { - this.type = type; - this.modifier = modifier; - - this.powerEnhancement = 0; - this.potencyEnhancement = 0; - this.costEnhancement = 0; - } - - public void enhanceEffect(SpellEnhancement enh) - { - if (enh != null) - { - switch (enh.getState()) - { - case SpellEnhancement.POWER: - this.powerEnhancement++; - break; - case SpellEnhancement.EFFICIENCY: - this.costEnhancement++; - break; - case SpellEnhancement.POTENCY: - this.potencyEnhancement++; - break; - } - } - } - - public void modifyEffect(ComplexSpellModifier mod) - { - if(mod != null) - { - this.modifier = mod; - } - } - - public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name and ask the registry - { - if(parad == null) - { - return; - } - - Class paraClass = parad.getClass(); - - ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); - - if(effect != null) - { - effect.modifyParadigm(parad); - } - } - - public int getCostOfEffect(SpellParadigm parad) - { - if(parad == null) - { - return 0; - } - - Class paraClass = parad.getClass(); - - ComplexSpellEffect effect = SpellEffectRegistry.getSpellEffect(paraClass, type, modifier, powerEnhancement, potencyEnhancement, costEnhancement); - - if(effect == null) - { - return 0; - } - - return effect.getCostOfEffect(); - } - - public NBTTagCompound getTag() - { - NBTTagCompound tag = new NBTTagCompound(); - - tag.setString("Class", this.getClass().getName()); - tag.setString("type", SpellEffectRegistry.getKeyForType(type)); - tag.setString("modifier", SpellEffectRegistry.getKeyForModifier(modifier)); - tag.setInteger("power", powerEnhancement); - tag.setInteger("cost", costEnhancement); - tag.setInteger("potency", potencyEnhancement); - - return tag; - } - - public static SpellEffect getEffectFromTag(NBTTagCompound tag) - { - try - { - Class clazz = Class.forName(tag.getString("Class")); - if (clazz != null) - { - try - { - Object obj = clazz.newInstance(); - if (obj instanceof SpellEffect) - { - SpellEffect eff = (SpellEffect) obj; - - eff.type = SpellEffectRegistry.getTypeForKey(tag.getString("type")); - eff.modifier = SpellEffectRegistry.getModifierForKey(tag.getString("modifier")); - eff.powerEnhancement = tag.getInteger("power"); - eff.costEnhancement = tag.getInteger("cost"); - eff.potencyEnhancement = tag.getInteger("potency"); - - return eff; - } - } catch (InstantiationException e) - { - e.printStackTrace(); - } catch (IllegalAccessException e) - { - e.printStackTrace(); - } - } - } catch (ClassNotFoundException e) - { - e.printStackTrace(); - } - return null; - } - - public int getPowerEnhancements() - { - return this.powerEnhancement; - } - - public int getPotencyEnhancements() - { - return this.potencyEnhancement; - } - - public int getCostEnhancements() - { - return this.costEnhancement; - } -} - -//package WayofTime.alchemicalWizardry.common.spell.complex.effect; -// -//import WayofTime.alchemicalWizardry.common.spell.complex.*; -//import WayofTime.alchemicalWizardry.common.spell.complex.enhancement.SpellEnhancement; -//import net.minecraft.nbt.NBTTagCompound; -// -//public abstract class SpellEffect -//{ -// protected int modifierState; -// protected int powerEnhancement; -// protected int costEnhancement; -// protected int potencyEnhancement; -// -// public SpellEffect() -// { -// this.modifierState = SpellModifier.DEFAULT; -// this.powerEnhancement = 0; -// this.costEnhancement = 0; -// this.potencyEnhancement = 0; -// } -// -// public void enhanceEffect(SpellEnhancement enh) -// { -// if (enh != null) -// { -// switch (enh.getState()) -// { -// case SpellEnhancement.POWER: -// this.powerEnhancement++; -// break; -// case SpellEnhancement.EFFICIENCY: -// this.costEnhancement++; -// break; -// case SpellEnhancement.POTENCY: -// this.potencyEnhancement++; -// break; -// } -// } -// } -// -// public void modifyEffect(SpellModifier mod) -// { -// if (mod != null) -// modifierState = mod.getModifier(); -// } -// -// public void modifyParadigm(SpellParadigm parad) //When modifying the paradigm it will instead get the class name and ask the registry -// { -// if (parad instanceof SpellParadigmProjectile) -// { -// this.modifyProjectileParadigm((SpellParadigmProjectile) parad); -// } -// if (parad instanceof SpellParadigmSelf) -// { -// this.modifySelfParadigm((SpellParadigmSelf) parad); -// } -// if (parad instanceof SpellParadigmMelee) -// { -// this.modifyMeleeParadigm((SpellParadigmMelee) parad); -// } -// if (parad instanceof SpellParadigmTool) -// { -// this.modifyToolParadigm((SpellParadigmTool) parad); -// } -// } -// -// public void modifyProjectileParadigm(SpellParadigmProjectile parad) -// { -// switch (modifierState) -// { -// case SpellModifier.DEFAULT: -// this.defaultModificationProjectile(parad); -// break; -// case SpellModifier.OFFENSIVE: -// this.offensiveModificationProjectile(parad); -// break; -// case SpellModifier.DEFENSIVE: -// this.defensiveModificationProjectile(parad); -// break; -// case SpellModifier.ENVIRONMENTAL: -// this.environmentalModificationProjectile(parad); -// break; -// } -// } -// -// public abstract void defaultModificationProjectile(SpellParadigmProjectile parad); -// -// public abstract void offensiveModificationProjectile(SpellParadigmProjectile parad); -// -// public abstract void defensiveModificationProjectile(SpellParadigmProjectile parad); -// -// public abstract void environmentalModificationProjectile(SpellParadigmProjectile parad); -// -// public void modifySelfParadigm(SpellParadigmSelf parad) -// { -// switch (modifierState) -// { -// case SpellModifier.DEFAULT: -// this.defaultModificationSelf(parad); -// break; -// case SpellModifier.OFFENSIVE: -// this.offensiveModificationSelf(parad); -// break; -// case SpellModifier.DEFENSIVE: -// this.defensiveModificationSelf(parad); -// break; -// case SpellModifier.ENVIRONMENTAL: -// this.environmentalModificationSelf(parad); -// break; -// } -// } -// -// public abstract void defaultModificationSelf(SpellParadigmSelf parad); -// -// public abstract void offensiveModificationSelf(SpellParadigmSelf parad); -// -// public abstract void defensiveModificationSelf(SpellParadigmSelf parad); -// -// public abstract void environmentalModificationSelf(SpellParadigmSelf parad); -// -// public void modifyMeleeParadigm(SpellParadigmMelee parad) -// { -// switch (modifierState) -// { -// case SpellModifier.DEFAULT: -// this.defaultModificationMelee(parad); -// break; -// case SpellModifier.OFFENSIVE: -// this.offensiveModificationMelee(parad); -// break; -// case SpellModifier.DEFENSIVE: -// this.defensiveModificationMelee(parad); -// break; -// case SpellModifier.ENVIRONMENTAL: -// this.environmentalModificationMelee(parad); -// break; -// } -// } -// -// public abstract void defaultModificationMelee(SpellParadigmMelee parad); -// -// public abstract void offensiveModificationMelee(SpellParadigmMelee parad); -// -// public abstract void defensiveModificationMelee(SpellParadigmMelee parad); -// -// public abstract void environmentalModificationMelee(SpellParadigmMelee parad); -// -// public void modifyToolParadigm(SpellParadigmTool parad) -// { -// switch (modifierState) -// { -// case SpellModifier.DEFAULT: -// this.defaultModificationTool(parad); -// break; -// case SpellModifier.OFFENSIVE: -// this.offensiveModificationTool(parad); -// break; -// case SpellModifier.DEFENSIVE: -// this.defensiveModificationTool(parad); -// break; -// case SpellModifier.ENVIRONMENTAL: -// this.environmentalModificationTool(parad); -// break; -// } -// } -// -// public abstract void defaultModificationTool(SpellParadigmTool parad); -// -// public abstract void offensiveModificationTool(SpellParadigmTool parad); -// -// public abstract void defensiveModificationTool(SpellParadigmTool parad); -// -// public abstract void environmentalModificationTool(SpellParadigmTool parad); -// -// public int getCostForProjectile() -// { -// switch (this.modifierState) -// { -// case SpellModifier.DEFAULT: -// return this.getCostForDefaultProjectile(); -// case SpellModifier.OFFENSIVE: -// return this.getCostForOffenseProjectile(); -// case SpellModifier.DEFENSIVE: -// return this.getCostForDefenseProjectile(); -// case SpellModifier.ENVIRONMENTAL: -// return this.getCostForEnvironmentProjectile(); -// } -// return 0; -// } -// -// protected abstract int getCostForDefaultProjectile(); -// -// protected abstract int getCostForOffenseProjectile(); -// -// protected abstract int getCostForDefenseProjectile(); -// -// protected abstract int getCostForEnvironmentProjectile(); -// -// public int getCostForSelf() -// { -// switch (this.modifierState) -// { -// case SpellModifier.DEFAULT: -// return this.getCostForDefaultSelf(); -// case SpellModifier.OFFENSIVE: -// return this.getCostForOffenseSelf(); -// case SpellModifier.DEFENSIVE: -// return this.getCostForDefenseSelf(); -// case SpellModifier.ENVIRONMENTAL: -// return this.getCostForEnvironmentSelf(); -// } -// return 0; -// } -// -// protected abstract int getCostForDefaultSelf(); -// -// protected abstract int getCostForOffenseSelf(); -// -// protected abstract int getCostForDefenseSelf(); -// -// protected abstract int getCostForEnvironmentSelf(); -// -// public int getCostForMelee() -// { -// switch (this.modifierState) -// { -// case SpellModifier.DEFAULT: -// return this.getCostForDefaultMelee(); -// case SpellModifier.OFFENSIVE: -// return this.getCostForOffenseMelee(); -// case SpellModifier.DEFENSIVE: -// return this.getCostForDefenseMelee(); -// case SpellModifier.ENVIRONMENTAL: -// return this.getCostForEnvironmentMelee(); -// } -// return 0; -// } -// -// protected abstract int getCostForDefaultMelee(); -// -// protected abstract int getCostForOffenseMelee(); -// -// protected abstract int getCostForDefenseMelee(); -// -// protected abstract int getCostForEnvironmentMelee(); -// -// public int getCostForTool() -// { -// switch (this.modifierState) -// { -// case SpellModifier.DEFAULT: -// return this.getCostForDefaultTool(); -// case SpellModifier.OFFENSIVE: -// return this.getCostForOffenseTool(); -// case SpellModifier.DEFENSIVE: -// return this.getCostForDefenseTool(); -// case SpellModifier.ENVIRONMENTAL: -// return this.getCostForEnvironmentTool(); -// } -// return 0; -// } -// -// protected abstract int getCostForDefaultTool(); -// -// protected abstract int getCostForOffenseTool(); -// -// protected abstract int getCostForDefenseTool(); -// -// protected abstract int getCostForEnvironmentTool(); -// -// public int getPowerEnhancements() -// { -// return this.powerEnhancement; -// } -// -// public int getCostEnhancements() -// { -// return this.costEnhancement; -// } -// -// public int getPotencyEnhancements() -// { -// return this.potencyEnhancement; -// } -// -// public NBTTagCompound getTag() -// { -// NBTTagCompound tag = new NBTTagCompound(); -// -// tag.setString("Class", this.getClass().getName()); -// tag.setInteger("modifier", modifierState); -// tag.setInteger("power", powerEnhancement); -// tag.setInteger("cost", costEnhancement); -// tag.setInteger("potency", potencyEnhancement); -// -// return tag; -// } -// -// public static SpellEffect getEffectFromTag(NBTTagCompound tag) -// { -// try -// { -// Class clazz = Class.forName(tag.getString("Class")); -// if (clazz != null) -// { -// try -// { -// Object obj = clazz.newInstance(); -// if (obj instanceof SpellEffect) -// { -// SpellEffect eff = (SpellEffect) obj; -// -// eff.modifierState = tag.getInteger("modifier"); -// eff.powerEnhancement = tag.getInteger("power"); -// eff.costEnhancement = tag.getInteger("cost"); -// eff.potencyEnhancement = tag.getInteger("potency"); -// -// return eff; -// } -// } catch (InstantiationException e) -// { -// e.printStackTrace(); -// } catch (IllegalAccessException e) -// { -// e.printStackTrace(); -// } -// } -// } catch (ClassNotFoundException e) -// { -// e.printStackTrace(); -// } -// return null; -// } -//} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java deleted file mode 100644 index f217b12..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEffectRegistry.java +++ /dev/null @@ -1,157 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - -public class SpellEffectRegistry -{ - public static Map, List> effectRegistry = new HashMap(); - public static Map typeRegistry = new HashMap(); - public static Map modifierRegistry = new HashMap(); - - public static void registerSpellEffect(Class paraClass, ComplexSpellEffect effect) - { - if(paraClass == null || effect == null) - { - return; - } - - if(effectRegistry.containsKey(paraClass)) - { - List effectList = effectRegistry.get(paraClass); - ComplexSpellType type = effect.getType(); - ComplexSpellModifier modifier = effect.getModifier(); - - if(type == null || modifier == null) - { - return; - } - - for(ComplexSpellEffect eff : effectList) - { - if(type.equals(eff.getType()) && modifier.equals(eff.getModifier())) - { - effectList.remove(eff); - effectList.add(effect); - return; - } - } - - effectList.add(effect); - }else - { - List effectList = new LinkedList(); - effectList.add(effect); - effectRegistry.put(paraClass, effectList); - } - } - - /** - * - * @param paraClass - * @param type - * @param mod - * @return A copy of the spell effect - */ - public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod) - { - return SpellEffectRegistry.getSpellEffect(paraClass, type, mod, 0, 0, 0); - } - - public static ComplexSpellEffect getSpellEffect(Class paraClass, ComplexSpellType type, ComplexSpellModifier mod, int power, int potency, int cost) - { - if(paraClass == null || type == null || mod == null) - { - return null; - } - - List list = effectRegistry.get(paraClass); - - if(list == null || list.isEmpty()) - { - return null; - } - - for(ComplexSpellEffect effect : list) - { - if(effect != null && type.equals(effect.type) && mod.equals(effect.modifier)) - { - return effect.copy(power, cost, potency); - } - } - - return null; - } - - public static void registerSpellType(String key, ComplexSpellType type) - { - typeRegistry.put(key, type); - } - - public static void registerSpellModifier(String key, ComplexSpellModifier modifier) - { - modifierRegistry.put(key, modifier); - } - - public static ComplexSpellType getTypeForKey(String key) - { - return typeRegistry.get(key); - } - - public static String getKeyForType(ComplexSpellType type) - { - if(type == null) - { - return ""; - } - - for(Entry entry : typeRegistry.entrySet()) - { - if(type.equals(entry.getValue())) - { - return entry.getKey(); - } - } - - return ""; - } - - public static ComplexSpellModifier getModifierForKey(String key) - { - return modifierRegistry.get(key); - } - - public static String getKeyForModifier(ComplexSpellModifier modifier) - { - if(modifier == null) - { - return ""; - } - - for(Entry entry : modifierRegistry.entrySet()) - { - if(modifier.equals(entry.getValue())) - { - return entry.getKey(); - } - } - - return ""; - } - - public static void initiateRegistry() - { - SpellEffectRegistry.registerSpellType("FIRE", ComplexSpellType.FIRE); - SpellEffectRegistry.registerSpellType("ICE", ComplexSpellType.ICE); - SpellEffectRegistry.registerSpellType("EARTH", ComplexSpellType.EARTH); - SpellEffectRegistry.registerSpellType("WIND", ComplexSpellType.WIND); - - SpellEffectRegistry.registerSpellModifier("DEFAULT", ComplexSpellModifier.DEFAULT); - SpellEffectRegistry.registerSpellModifier("OFFENSIVE", ComplexSpellModifier.OFFENSIVE); - SpellEffectRegistry.registerSpellModifier("DEFENSIVE", ComplexSpellModifier.DEFENSIVE); - SpellEffectRegistry.registerSpellModifier("ENVIRONMENTAL", ComplexSpellModifier.ENVIRONMENTAL); - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java deleted file mode 100644 index acbbdcc..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancement.java +++ /dev/null @@ -1,20 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class SpellEnhancement -{ - public static final int POWER = 0; - public static final int EFFICIENCY = 1; - public static final int POTENCY = 2; - - private int state = this.POWER; - - protected SpellEnhancement(int state) - { - this.state = state; - } - - public int getState() - { - return this.state; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java deleted file mode 100644 index 8078ce6..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementCost.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class SpellEnhancementCost extends SpellEnhancement -{ - - public SpellEnhancementCost() - { - super(SpellEnhancement.EFFICIENCY); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java deleted file mode 100644 index a540f89..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPotency.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class SpellEnhancementPotency extends SpellEnhancement -{ - public SpellEnhancementPotency() - { - super(SpellEnhancement.POTENCY); - } - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java deleted file mode 100644 index 044ef10..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellEnhancementPower.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -public class SpellEnhancementPower extends SpellEnhancement -{ - - public SpellEnhancementPower() - { - super(SpellEnhancement.POWER); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java deleted file mode 100644 index 5423cb4..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigm.java +++ /dev/null @@ -1,131 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.LinkedList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public abstract class SpellParadigm -{ - protected List bufferedEffectList = new LinkedList(); - - public void addBufferedEffect(SpellEffect effect) - { - if (effect != null) - { - this.bufferedEffectList.add(effect); - } - } - - public void modifyBufferedEffect(ComplexSpellModifier modifier) - { - SpellEffect effect = this.getBufferedEffect(); - if (effect != null) - { - effect.modifyEffect(modifier); - } - } - - public void applyEnhancement(SpellEnhancement enh) - { - if (enh != null) - { - if (bufferedEffectList.isEmpty()) - { - this.enhanceParadigm(enh); - } else - { - SpellEffect effect = this.getBufferedEffect(); - if (effect != null) - { - effect.enhanceEffect(enh); - } - } - } - - } - - public abstract void enhanceParadigm(SpellEnhancement enh); - - public abstract void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack); - - public void applySpellEffect(SpellEffect effect) - { - effect.modifyParadigm(this); - } - - public void applyAllSpellEffects() - { - for (SpellEffect effect : bufferedEffectList) - { - this.applySpellEffect(effect); - } - } - - public SpellEffect getBufferedEffect() - { - if (bufferedEffectList.isEmpty()) - { - return null; - } else - { - return bufferedEffectList.get(bufferedEffectList.size() - 1); - } - } - - public int getTotalCost() - { - int cost = 0; - if (this.bufferedEffectList != null && !this.bufferedEffectList.isEmpty()) - { - for(SpellEffect effect : bufferedEffectList) - { - cost += effect.getCostOfEffect(this); - } - - return (int) (cost * Math.sqrt(this.bufferedEffectList.size())); - } - - return getDefaultCost(); - } - - public abstract int getDefaultCost(); - - public int getBufferedEffectPower() - { - SpellEffect eff = this.getBufferedEffect(); - - if (eff != null) - { - return eff.getPowerEnhancements(); - } - - return 0; - } - - public int getBufferedEffectCost() - { - SpellEffect eff = this.getBufferedEffect(); - - if (eff != null) - { - return eff.getCostEnhancements(); - } - - return 0; - } - - public int getBufferedEffectPotency() - { - SpellEffect eff = this.getBufferedEffect(); - - if (eff != null) - { - return eff.getPotencyEnhancements(); - } - - return 0; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java deleted file mode 100644 index 629f7db..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmMelee.java +++ /dev/null @@ -1,70 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -public class SpellParadigmMelee extends SpellParadigm -{ - private List entityEffectList; - private List worldEffectList; - - public SpellParadigmMelee() - { - this.entityEffectList = new ArrayList(); - this.worldEffectList = new ArrayList(); - } - - @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } - - @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; - } - - for (IMeleeSpellEntityEffect effect : entityEffectList) - { - effect.onEntityImpact(world, entityPlayer); - } - - for (IMeleeSpellWorldEffect effect : worldEffectList) - { - effect.onWorldEffect(world, entityPlayer); - } - } - - public void addEntityEffect(IMeleeSpellEntityEffect eff) - { - if (eff != null) - { - this.entityEffectList.add(eff); - } - } - - public void addWorldEffect(IMeleeSpellWorldEffect eff) - { - if (eff != null) - { - this.worldEffectList.add(eff); - } - } - - @Override - public int getDefaultCost() - { - return 0; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java deleted file mode 100644 index 8b6f6a3..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmProjectile.java +++ /dev/null @@ -1,101 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.util.DamageSource; -import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -public class SpellParadigmProjectile extends SpellParadigm -{ - public DamageSource damageSource; - public float damage; - public int cost; - public List impactList; - public List updateEffectList; - public boolean penetration; - public int ricochetMax; - public boolean isSilkTouch; - - public SpellParadigmProjectile() - { - this.damageSource = DamageSource.generic; - this.damage = 1; - this.cost = 0; - this.impactList = new ArrayList(); - this.updateEffectList = new ArrayList(); - this.penetration = false; - this.ricochetMax = 0; - this.isSilkTouch = false; - } - - @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } - - @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; - } - - EntitySpellProjectile proj = new EntitySpellProjectile(world, entityPlayer); - this.prepareProjectile(proj); - world.spawnEntityInWorld(proj); - } - - public static SpellParadigmProjectile getParadigmForEffectArray(List effectList) - { - SpellParadigmProjectile parad = new SpellParadigmProjectile(); - - for (SpellEffect eff : effectList) - { - parad.addBufferedEffect(eff); - } - - return parad; - } - - public void prepareProjectile(EntitySpellProjectile proj) - { - proj.setDamage(damage); - proj.setImpactList(impactList); - proj.setUpdateEffectList(updateEffectList); - proj.setPenetration(penetration); - proj.setRicochetMax(ricochetMax); - proj.setIsSilkTouch(isSilkTouch); - proj.setSpellEffectList(bufferedEffectList); - } - - public void addImpactEffect(IProjectileImpactEffect eff) - { - if (eff != null) - { - this.impactList.add(eff); - } - } - - public void addUpdateEffect(IProjectileUpdateEffect eff) - { - if (eff != null) - { - this.updateEffectList.add(eff); - } - } - - @Override - public int getDefaultCost() - { - return 50; - } - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java deleted file mode 100644 index 89cffe0..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmSelf.java +++ /dev/null @@ -1,58 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.ArrayList; -import java.util.List; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -public class SpellParadigmSelf extends SpellParadigm -{ - public List selfSpellEffectList; - - public SpellParadigmSelf() - { - selfSpellEffectList = new ArrayList(); - } - - @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } - - @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack itemStack) - { - this.applyAllSpellEffects(); - - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(itemStack, entityPlayer, cost)) - { - return; - } - - for (ISelfSpellEffect eff : selfSpellEffectList) - { - eff.onSelfUse(world, entityPlayer); - } - } - - public void addSelfSpellEffect(ISelfSpellEffect eff) - { - if (eff != null) - { - this.selfSpellEffectList.add(eff); - } - } - - @Override - public int getDefaultCost() - { - return 100; - } - -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java b/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java deleted file mode 100644 index f6cc001..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/spell/SpellParadigmTool.java +++ /dev/null @@ -1,485 +0,0 @@ -package WayofTime.alchemicalWizardry.api.spell; - -import java.util.HashMap; -import java.util.LinkedList; -import java.util.List; -import java.util.Map.Entry; -import java.util.Set; - -import net.minecraft.block.Block; -import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.items.ItemSpellMultiTool; -import WayofTime.alchemicalWizardry.api.soulNetwork.SoulNetworkHandler; - -public class SpellParadigmTool extends SpellParadigm -{ - private List leftClickEffectList; - private List rightClickEffectList; - private List toolUpdateEffectList; - private List toolSummonEffectList; - private List toolBanishEffectList; - private List breakBlockEffectList; - private List itemManipulatorEffectList; - private List digAreaEffectList; - private List specialDamageEffectList; - - private float maxDamage; - private HashMap harvestLevel; - private HashMap digSpeed; - private HashMap maxDamageHash; - private HashMap critChanceHash; - private HashMap durationHash; - - private HashMap toolInfoString; - - private int fortuneLevel; - private boolean silkTouch; - - private int duration; - - public static Item customTool; - - public SpellParadigmTool() - { - this.leftClickEffectList = new LinkedList(); - this.rightClickEffectList = new LinkedList(); - this.toolUpdateEffectList = new LinkedList(); - this.toolSummonEffectList = new LinkedList(); - this.toolBanishEffectList = new LinkedList(); - this.breakBlockEffectList = new LinkedList(); - this.itemManipulatorEffectList = new LinkedList(); - this.digAreaEffectList = new LinkedList(); - this.specialDamageEffectList = new LinkedList(); - this.durationHash = new HashMap(); - - this.toolInfoString = new HashMap(); - this.critChanceHash = new HashMap(); - - this.maxDamage = 5; - - this.harvestLevel = new HashMap(); - this.harvestLevel.put("pickaxe", -1); - this.harvestLevel.put("shovel", -1); - this.harvestLevel.put("axe", -1); - - this.digSpeed = new HashMap(); - this.digSpeed.put("pickaxe", 1.0f); - this.digSpeed.put("shovel", 1.0f); - this.digSpeed.put("axe", 1.0f); - - this.maxDamageHash = new HashMap(); - this.maxDamageHash.put("default", 5.0f); - - this.fortuneLevel = 0; - this.silkTouch = false; - this.duration = 0; - this.durationHash.put("default", 2400); - } - - @Override - public void enhanceParadigm(SpellEnhancement enh) - { - - } - - @Override - public void castSpell(World world, EntityPlayer entityPlayer, ItemStack crystal) - { - if (entityPlayer.worldObj.isRemote) - { - return; - } - - int cost = this.getTotalCost(); - - if(!SoulNetworkHandler.syphonAndDamageFromNetwork(crystal, entityPlayer, cost)) - { - return; - } - - ItemStack toolStack = this.prepareTool(crystal, world); - - entityPlayer.setCurrentItemOrArmor(0, toolStack); - - this.onSummonTool(toolStack, world, entityPlayer); - } - - /** - * @param crystalStack - * @return stack containing the new multitool - */ - public ItemStack prepareTool(ItemStack crystalStack, World world) - { - ItemStack toolStack = new ItemStack(customTool, 1); - - ItemSpellMultiTool itemTool = (ItemSpellMultiTool) customTool; - - itemTool.setItemAttack(toolStack, this.composeMaxDamageFromHash()); - - Set> harvestLevelSet = this.harvestLevel.entrySet(); - - for (Entry testMap : harvestLevelSet) - { - String tool = testMap.getKey(); - int level = testMap.getValue(); - - itemTool.setHarvestLevel(toolStack, tool, level); - } - - Set> digSpeedSet = this.digSpeed.entrySet(); - - for (Entry testMap : digSpeedSet) - { - String tool = testMap.getKey(); - float speed = testMap.getValue(); - - itemTool.setDigSpeed(toolStack, tool, speed); - } - - itemTool.setFortuneLevel(toolStack, getFortuneLevel()); - itemTool.setSilkTouch(toolStack, this.getSilkTouch()); - - if (this.getSilkTouch()) - { - this.addToolString("SilkTouch", "Silk Touch" + " " + APISpellHelper.getNumeralForInt(1)); - } - - if (this.getFortuneLevel() > 0) - { - this.addToolString("Fortune", "Fortune" + " " + APISpellHelper.getNumeralForInt(this.getFortuneLevel())); - } - - itemTool.setCritChance(toolStack, this.getCritChance() / 100f); - - List toolStringList = new LinkedList(); - - for (String str : this.toolInfoString.values()) - { - toolStringList.add(str); - } - - itemTool.setToolListString(toolStack, toolStringList); - - for (Integer integ : this.durationHash.values()) - { - this.duration += integ; - } - - itemTool.setDuration(toolStack, world, this.duration); - itemTool.loadParadigmIntoStack(toolStack, this.bufferedEffectList); - - SoulNetworkHandler.checkAndSetItemOwner(toolStack, SoulNetworkHandler.getOwnerName(crystalStack)); - - itemTool.setContainedCrystal(toolStack, crystalStack); - - return toolStack; - } - - @Override - public int getDefaultCost() - { - return 100; - } - - public static SpellParadigmTool getParadigmForEffectArray(List effectList) - { - SpellParadigmTool parad = new SpellParadigmTool(); - - for (SpellEffect eff : effectList) - { - parad.addBufferedEffect(eff); - } - - parad.applyAllSpellEffects(); - - return parad; - } - - public void addLeftClickEffect(ILeftClickEffect eff) - { - if (eff != null) - { - this.leftClickEffectList.add(eff); - } - } - - public void addRightClickEffect(IRightClickEffect eff) - { - if (eff != null) - { - this.rightClickEffectList.add(eff); - } - } - - public void addUpdateEffect(IToolUpdateEffect eff) - { - if (eff != null) - { - this.toolUpdateEffectList.add(eff); - } - } - - public void addToolSummonEffect(IOnSummonTool eff) - { - if (eff != null) - { - this.toolSummonEffectList.add(eff); - } - } - - public void addToolBanishEffect(IOnBanishTool eff) - { - if (eff != null) - { - this.toolBanishEffectList.add(eff); - } - } - - public void addBlockBreakEffect(IOnBreakBlock eff) - { - if (eff != null) - { - this.breakBlockEffectList.add(eff); - } - } - - public void addItemManipulatorEffect(IItemManipulator eff) - { - if (eff != null) - { - this.itemManipulatorEffectList.add(eff); - } - } - - public void addDigAreaEffect(IDigAreaEffect eff) - { - if (eff != null) - { - this.digAreaEffectList.add(eff); - } - } - - public void addSpecialDamageEffect(ISpecialDamageEffect eff) - { - if (eff != null) - { - this.specialDamageEffectList.add(eff); - } - } - - public int onLeftClickEntity(ItemStack stack, EntityLivingBase attacked, EntityLivingBase weilder) - { - int total = 0; - for (ILeftClickEffect effect : this.leftClickEffectList) - { - total += effect.onLeftClickEntity(stack, attacked, weilder); - } - - return total; - } - - public int onRightClickBlock(ItemStack toolStack, EntityLivingBase weilder, World world, MovingObjectPosition mop) - { - int total = 0; - for (IRightClickEffect effect : this.rightClickEffectList) - { - total += effect.onRightClickBlock(toolStack, weilder, world, mop); - } - - return total; - } - - public int onRightClickAir(ItemStack toolStack, World world, EntityPlayer player) - { - int total = 0; - for (IRightClickEffect effect : this.rightClickEffectList) - { - total += effect.onRightClickAir(toolStack, player); - } - - return total; - } - - public int onUpdate(ItemStack toolStack, World world, Entity par3Entity, int invSlot, boolean inHand) - { - int total = 0; - for (IToolUpdateEffect effect : this.toolUpdateEffectList) - { - total += effect.onUpdate(toolStack, world, par3Entity, invSlot, inHand); - } - - return total; - } - - public int onSummonTool(ItemStack toolStack, World world, Entity entity) - { - int total = 0; - for (IOnSummonTool effect : this.toolSummonEffectList) - { - total += effect.onSummonTool(toolStack, world, entity); - } - - return total; - } - - public int onBanishTool(ItemStack toolStack, World world, Entity entity, int invSlot, boolean inHand) - { - int total = 0; - for (IOnBanishTool effect : this.toolBanishEffectList) - { - total += effect.onBanishTool(toolStack, world, entity, invSlot, inHand); - } - - return total; - } - - public int onBreakBlock(ItemStack container, World world, EntityPlayer player, Block block, int meta, int x, int y, int z, ForgeDirection sideBroken) - { - int total = 0; - for (IOnBreakBlock effect : this.breakBlockEffectList) - { - total += effect.onBlockBroken(container, world, player, block, meta, x, y, z, sideBroken); - } - - return total; - } - - public List handleItemList(ItemStack toolStack, List items) - { - List heldList = items; - - for (IItemManipulator eff : this.itemManipulatorEffectList) - { - List newHeldList = eff.handleItemsOnBlockBroken(toolStack, heldList); - heldList = newHeldList; - } - - return heldList; - } - - public int digSurroundingArea(ItemStack container, World world, EntityPlayer player, MovingObjectPosition blockPos, String usedToolClass, float blockHardness, int harvestLvl, ItemSpellMultiTool itemTool) - { - int cost = 0; - - for (IDigAreaEffect effect : this.digAreaEffectList) - { - cost += effect.digSurroundingArea(container, world, player, blockPos, usedToolClass, blockHardness, harvestLvl, itemTool); - } - - return cost; - } - - public int getFortuneLevel() - { - return this.fortuneLevel; - } - - public void setFortuneLevel(int fortuneLevel) - { - this.fortuneLevel = fortuneLevel; - } - - public boolean getSilkTouch() - { - return this.silkTouch; - } - - public void setSilkTouch(boolean silkTouch) - { - this.silkTouch = silkTouch; - } - - public int getDuration() - { - return this.duration; - } - - public void setDuration(int duration) - { - this.duration = duration; - } - - public void setDigSpeed(String toolClass, float digSpeed) - { - this.digSpeed.put(toolClass, digSpeed); - } - - public void setHarvestLevel(String toolClass, int hlvl) - { - this.harvestLevel.put(toolClass, hlvl); - } - - public float composeMaxDamageFromHash() - { - float damage = 0.0f; - - for (float f : this.maxDamageHash.values()) - { - damage += f; - } - - return damage; - } - - public void addDamageToHash(String key, float dmg) - { - this.maxDamageHash.put(key, dmg); - } - - public void addToolString(String key, String str) - { - if (str != null && key != null) - { - this.toolInfoString.put(key, str); - } - } - - public void addCritChance(String key, float chance) - { - //Chance is in percentage chance i.e. chance = 1.0 means 1.0% - this.critChanceHash.put(key, chance); - } - - public void addDuration(String key, int dur) - { - this.durationHash.put(key, dur); - } - - public float getCritChance() - { - float chance = 0.0f; - - for (float fl : this.critChanceHash.values()) - { - chance += fl; - } - - return chance; - } - - public float getAddedDamageForEntity(Entity entity) - { - HashMap hash = new HashMap(); - - for (ISpecialDamageEffect effect : this.specialDamageEffectList) - { - hash.put(effect.getKey(), effect.getDamageForEntity(entity)); - } - - float addedDmg = 0.0f; - - for (float fl : hash.values()) - { - addedDmg += fl; - } - - return addedDmg; - } -} \ No newline at end of file diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java b/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java deleted file mode 100644 index 84c4d3a..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningHelper.java +++ /dev/null @@ -1,21 +0,0 @@ -package WayofTime.alchemicalWizardry.api.summoningRegistry; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.world.World; - -public abstract class SummoningHelper -{ - protected String id; - - public SummoningHelper(String id) - { - this.id = id; - } - - public abstract EntityLivingBase getEntity(World worldObj); - - public String getSummoningHelperID() - { - return id; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java b/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java deleted file mode 100644 index 18180d8..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistry.java +++ /dev/null @@ -1,70 +0,0 @@ -package WayofTime.alchemicalWizardry.api.summoningRegistry; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -import java.util.ArrayList; -import java.util.List; - -public class SummoningRegistry -{ - public static List summoningList = new ArrayList(); - - public static void registerSummon(SummoningHelper s, ItemStack[] ring1, ItemStack[] ring2, ItemStack[] ring3, int amountUsed, int bloodOrbLevel) - { - summoningList.add(new SummoningRegistryComponent(s, ring1, ring2, ring3, amountUsed, bloodOrbLevel)); - } - - public static boolean isRecipeValid(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { - return true; - } - } - - return false; - } - - public static SummoningRegistryComponent getRegistryComponent(int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { - return src; - } - } - - return null; - } - - public static EntityLivingBase getEntity(World worldObj, int bloodOrbLevel, ItemStack[] test1, ItemStack[] test2, ItemStack[] test3) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getBloodOrbLevel() <= bloodOrbLevel && src.compareRing(1, test1) && src.compareRing(2, test2) && src.compareRing(3, test3)) - { - return src.getEntity(worldObj); - } - } - - return null; - } - - public static EntityLivingBase getEntityWithID(World worldObj, String id) - { - for (SummoningRegistryComponent src : summoningList) - { - if (src.getSummoningHelperID().equals(id)) - { - return src.getEntity(worldObj); - } - } - - return null; - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java b/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java deleted file mode 100644 index 72dbd83..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/summoningRegistry/SummoningRegistryComponent.java +++ /dev/null @@ -1,231 +0,0 @@ -package WayofTime.alchemicalWizardry.api.summoningRegistry; - -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.item.ItemBlock; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.oredict.OreDictionary; - -public class SummoningRegistryComponent -{ - public ItemStack[] ring1 = new ItemStack[6]; - public ItemStack[] ring2 = new ItemStack[6]; - public ItemStack[] ring3 = new ItemStack[6]; - public SummoningHelper summoningHelper; - public int summoningCost; - public int bloodOrbLevel; - - public SummoningRegistryComponent(SummoningHelper s, ItemStack[] newRing1, ItemStack[] newRing2, ItemStack[] newRing3, int amount, int bloodOrbLevel) - { - this.summoningHelper = s; - this.ring1 = newRing1; - this.ring2 = newRing2; - this.ring3 = newRing3; - this.summoningCost = amount; - this.bloodOrbLevel = bloodOrbLevel; - - if (this.ring1.length != 6) - { - ItemStack[] newRecipe = new ItemStack[6]; - - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring1.length) - { - newRecipe[i] = null; - } else - { - newRecipe[i] = this.ring1[i]; - } - } - - this.ring1 = newRecipe; - } - - if (this.ring2.length != 6) - { - ItemStack[] newRecipe = new ItemStack[6]; - - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring2.length) - { - newRecipe[i] = null; - } else - { - newRecipe[i] = this.ring2[i]; - } - } - - this.ring2 = newRecipe; - } - - if (this.ring3.length != 6) - { - ItemStack[] newRecipe = new ItemStack[6]; - - for (int i = 0; i < 6; i++) - { - if (i + 1 > this.ring3.length) - { - newRecipe[i] = null; - } else - { - newRecipe[i] = this.ring3[i]; - } - } - - this.ring3 = newRecipe; - } - } - - public boolean compareRing(int ring, ItemStack[] checkedRingRecipe) - { - ItemStack[] recipe; - - if (checkedRingRecipe.length < 6) - { - return false; - } - - switch (ring) - { - case 1: - recipe = ring1; - break; - - case 2: - recipe = ring2; - break; - - case 3: - recipe = ring3; - break; - - default: - recipe = ring1; - } - - if (recipe.length != 6) - { - ItemStack[] newRecipe = new ItemStack[6]; - - for (int i = 0; i < 6; i++) - { - if (i + 1 > recipe.length) - { - newRecipe[i] = null; - } else - { - newRecipe[i] = recipe[i]; - } - } - - recipe = newRecipe; - } - - boolean[] checkList = new boolean[6]; - - for (int i = 0; i < 6; i++) - { - checkList[i] = false; - } - - for (int i = 0; i < 6; i++) - { - ItemStack recipeItemStack = recipe[i]; - - if (recipeItemStack == null) - { - continue; - } - - boolean test = false; - - for (int j = 0; j < 6; j++) - { - if (checkList[j]) - { - continue; - } - - ItemStack checkedItemStack = checkedRingRecipe[j]; - - if (checkedItemStack == null) - { - continue; - } - - boolean quickTest = false; - - if (recipeItemStack.getItem() instanceof ItemBlock) - { - if (checkedItemStack.getItem() instanceof ItemBlock) - { - quickTest = true; - } - } else if (!(checkedItemStack.getItem() instanceof ItemBlock)) - { - quickTest = true; - } - - if (!quickTest) - { - continue; - } - - if ((checkedItemStack.getItemDamage() == recipeItemStack.getItemDamage() || OreDictionary.WILDCARD_VALUE == recipeItemStack.getItemDamage()) && checkedItemStack.getItem() == recipeItemStack.getItem()) - { - test = true; - checkList[j] = true; - break; - } - } - - if (!test) - { - return false; - } - } - - return true; - } - - public int getSummoningCost() - { - return summoningCost; - } - - public EntityLivingBase getEntity(World world) - { - return this.summoningHelper.getEntity(world); - } - - public int getBloodOrbLevel() - { - return this.bloodOrbLevel; - } - - public ItemStack[] getRingRecipeForRing(int ring) - { - switch (ring) - { - case 1: - return ring1; - - case 2: - return ring2; - - case 3: - return ring3; - - default: - return null; - } - } - - public String getSummoningHelperID() - { - return this.summoningHelper.getSummoningHelperID(); - } -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java b/src/api/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java deleted file mode 100644 index c70d618..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/tile/IBloodAltar.java +++ /dev/null @@ -1,26 +0,0 @@ -package WayofTime.alchemicalWizardry.api.tile; - -/** - * Created by Pokefenn. - */ -public interface IBloodAltar -{ - - public int getCapacity(); - - public int getCurrentBlood(); - - public int getTier(); - - public int getProgress(); - - public float getSacrificeMultiplier(); - - public float getSelfSacrificeMultiplier(); - - public float getOrbMultiplier(); - - public float getDislocationMultiplier(); - - public int getBufferCapacity(); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java b/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java deleted file mode 100644 index de9994b..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellParadigmTile.java +++ /dev/null @@ -1,10 +0,0 @@ -package WayofTime.alchemicalWizardry.api.tile; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -public interface ISpellParadigmTile extends ISpellTile -{ - public void castSpell(World world, EntityPlayer entity, ItemStack spellCasterStack); -} diff --git a/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java b/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java deleted file mode 100644 index 143a0ea..0000000 --- a/src/api/java/WayofTime/alchemicalWizardry/api/tile/ISpellTile.java +++ /dev/null @@ -1,11 +0,0 @@ -package WayofTime.alchemicalWizardry.api.tile; - -import net.minecraftforge.common.util.ForgeDirection; -import WayofTime.alchemicalWizardry.api.spell.SpellParadigm; - -public interface ISpellTile -{ - public void modifySpellParadigm(SpellParadigm parad); - - public boolean canInputRecieveOutput(ForgeDirection output); -} diff --git a/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java new file mode 100644 index 0000000..8c74b4b --- /dev/null +++ b/src/api/java/pneumaticCraft/api/recipe/AssemblyRecipe.java @@ -0,0 +1,49 @@ +package pneumaticCraft.api.recipe; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.block.Block; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; + +public class AssemblyRecipe{ + public static List drillRecipes = new ArrayList(); + public static List laserRecipes = new ArrayList(); + public static List drillLaserRecipes = new ArrayList(); + + private final ItemStack input; + private final ItemStack output; + + public AssemblyRecipe(ItemStack input, ItemStack output){ + this.input = input; + this.output = output; + } + + public ItemStack getInput(){ + return input; + } + + public ItemStack getOutput(){ + return output; + } + + public static void addDrillRecipe(Object input, Object output){ + drillRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); + } + + public static void addLaserRecipe(Object input, Object output){ + laserRecipes.add(new AssemblyRecipe(getStackFromObject(input), getStackFromObject(output))); + } + + private static ItemStack getStackFromObject(Object object){ + if(object instanceof Block) { + return new ItemStack((Block)object); + } else if(object instanceof Item) { + return new ItemStack((Item)object); + } else { + return (ItemStack)object; + } + } + +} diff --git a/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java new file mode 100644 index 0000000..93eba67 --- /dev/null +++ b/src/api/java/pneumaticCraft/api/recipe/IPressureChamberRecipe.java @@ -0,0 +1,34 @@ +package pneumaticCraft.api.recipe; + +import net.minecraft.item.ItemStack; + +public interface IPressureChamberRecipe{ + + /** + * Returns the threshold which is minimal to craft the recipe. Negative pressures also work. + * @return threshold pressure + */ + public float getCraftingPressure(); + + /** + * This method should return the used items in the recipe when the right items are provided to craft this recipe. + * @param inputStacks + * @return usedStacks, return null when the inputStacks aren't valid for this recipe. + */ + public ItemStack[] isValidRecipe(ItemStack[] inputStacks); + + /** + * When returned true, only the exact same references of the stacks returned by isValidRecipe() will be removed. This is useful + * to remove stacks with a certain NBT value (like Enchanted Books). Return false for normal behaviour. + * @return true if exact stacks should be removed only. + */ + public boolean shouldRemoveExactStacks(); + + /** + * This method will be called when the recipe should output its items. the stacks the recipe output, may be dependent on the input stacks. + * @param removedStacks same reference to the stacks returned by isValidRecipe. + * @param inputStacks. These stacks can be modified (like adding/removing NBT data eg.) + * @return outputStacks. Stacks that will pop 'out of the chamber' + */ + public ItemStack[] craftRecipe(ItemStack[] inputStacks, ItemStack[] removedStacks); +} diff --git a/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java new file mode 100644 index 0000000..5d6b29e --- /dev/null +++ b/src/api/java/pneumaticCraft/api/recipe/PressureChamberRecipe.java @@ -0,0 +1,24 @@ +package pneumaticCraft.api.recipe; + +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.item.ItemStack; + +public class PressureChamberRecipe{ + public static List chamberRecipes = new ArrayList(); + public static List specialRecipes = new ArrayList(); + + public final ItemStack[] input; + public final ItemStack[] output; + public final float pressure; + public final boolean outputAsBlock; + + public PressureChamberRecipe(ItemStack[] input, float pressureRequired, ItemStack[] output, boolean outputAsBlock){ + this.input = input; + this.output = output; + pressure = pressureRequired; + this.outputAsBlock = outputAsBlock; + } + +} diff --git a/src/main/java/modtweaker/mods/forestry/handlers/Still.java b/src/main/java/modtweaker/mods/forestry/handlers/Still.java index beba232..c858838 100644 --- a/src/main/java/modtweaker/mods/forestry/handlers/Still.java +++ b/src/main/java/modtweaker/mods/forestry/handlers/Still.java @@ -6,6 +6,9 @@ import static modtweaker.helpers.InputHelper.getFluid; import java.util.List; +import cpw.mods.fml.common.registry.EntityRegistry; +import cpw.mods.fml.common.registry.EntityRegistry.EntityRegistration; +import cpw.mods.fml.common.registry.GameRegistry; import minetweaker.MineTweakerAPI; import minetweaker.api.item.IItemStack; import minetweaker.api.liquid.ILiquidStack; @@ -19,6 +22,7 @@ import stanhebben.zenscript.annotations.ZenMethod; import forestry.Forestry; import forestry.api.core.ForestryAPI; import forestry.core.utils.LiquidHelper; +import forestry.core.utils.RecipeUtil; import forestry.factory.gadgets.MachineSqueezer; import forestry.factory.gadgets.MachineStill; import forestry.factory.gadgets.MachineStill.Recipe; @@ -29,6 +33,9 @@ public class Still { @ZenMethod public static void addRecipe(int timePerUnit, ILiquidStack input, ILiquidStack output) { + output.amount(output.getAmount() / 100); + input.amount(input.getAmount() / 100); + MineTweakerAPI.apply(new Add(new Recipe(timePerUnit, toFluid(input), toFluid(output)))); MachineStill.RecipeManager.recipeFluidInputs.add(getFluid(input)); MachineStill.RecipeManager.recipeFluidOutputs.add(getFluid(output));