From 646e74e32945c49d9e2c14979e92667b727783ae Mon Sep 17 00:00:00 2001 From: pahimar Date: Sun, 19 Apr 2015 15:01:35 -0400 Subject: [PATCH] Yay test cases pass successfully! --- .../java/com/pahimar/ee3/api/EnergyValue.java | 64 +---- .../ee3/api/EnergyValueRegistryProxy.java | 39 +-- .../gui/inventory/GuiTransmutationTablet.java | 2 +- .../handler/ItemTooltipEventHandler.java | 29 +- .../ee3/command/CommandSetEnergyValue.java | 4 +- .../CommandSetEnergyValueCurrentItem.java | 4 +- .../ee3/exchange/CachedOreDictionary.java | 4 +- .../DynamicEnergyValueInitThread.java | 4 +- .../ee3/exchange/EnergyValueRegistry.java | 143 +++++++--- .../pahimar/ee3/exchange/WrappedStack.java | 36 ++- .../com/pahimar/ee3/init/EnergyValues.java | 259 ++++++++---------- .../ContainerTransmutationTablet.java | 8 +- .../ee3/item/crafting/RecipeAludel.java | 10 +- .../ee3/knowledge/AbilityRegistry.java | 12 +- .../pahimar/ee3/nei/CalcinationHandler.java | 2 +- .../pahimar/ee3/recipe/RecipeRegistry.java | 26 +- .../pahimar/ee3/recipe/RecipesPotions.java | 146 +++++----- .../pahimar/ee3/recipe/RecipesVanilla.java | 11 + .../java/com/pahimar/ee3/reference/Names.java | 5 + .../test/EnergyValueMappingsTestSuite.java | 27 +- .../ee3/test/VanillaEnergyValueTest.java | 218 +++++++-------- .../TileEntityTransmutationTablet.java | 17 +- .../pahimar/ee3/util/EnergyValueHelper.java | 10 +- .../com/pahimar/ee3/util/FilterUtils.java | 8 +- .../com/pahimar/ee3/util/FluidHelper.java | 5 +- .../java/com/pahimar/ee3/util/ItemHelper.java | 2 +- .../com/pahimar/ee3/util/RecipeHelper.java | 24 +- src/main/resources/assets/ee3/lang/en_US.lang | 3 + 28 files changed, 592 insertions(+), 530 deletions(-) diff --git a/src/main/java/com/pahimar/ee3/api/EnergyValue.java b/src/main/java/com/pahimar/ee3/api/EnergyValue.java index e9231431..9804e5da 100644 --- a/src/main/java/com/pahimar/ee3/api/EnergyValue.java +++ b/src/main/java/com/pahimar/ee3/api/EnergyValue.java @@ -14,22 +14,12 @@ public final class EnergyValue implements Comparable, JsonDeseriali public EnergyValue() { - this(0f); + this(0); } - public EnergyValue(int energyValue) + public EnergyValue(Number energyValue) { - this((float) energyValue); - } - - public EnergyValue(double energyValue) - { - this((float) energyValue); - } - - public EnergyValue(float energyValue) - { - this.energyValue = energyValue; + this.energyValue = energyValue.floatValue(); } @Override @@ -49,7 +39,7 @@ public final class EnergyValue implements Comparable, JsonDeseriali { if (energyValue != null) { - return Float.compare(this.energyValue, energyValue.getEnergyValue()); + return Float.compare(this.energyValue, energyValue.getValue()); } else { @@ -57,56 +47,14 @@ public final class EnergyValue implements Comparable, JsonDeseriali } } - public float getEnergyValue() + public float getValue() { return this.energyValue; } - public void add(int energyValue) - { - this.add((float) energyValue); - } - - public void add(float energyValue) - { - if (energyValue >= 0f) - { - this.energyValue += energyValue; - } - } - - public void add(EnergyValue energyValue) - { - if (energyValue != null && energyValue.energyValue >= 0f) - { - this.energyValue += energyValue.energyValue; - } - } - - public void subtract(int energyValue) - { - this.subtract((float) energyValue); - } - - public void subtract(float energyValue) - { - if (this.energyValue - energyValue >= 0f) - { - this.energyValue -= energyValue; - } - } - - public void subtract(EnergyValue energyValue) - { - if (energyValue != null && (this.energyValue - energyValue.energyValue) >= 0f) - { - this.energyValue -= energyValue.energyValue; - } - } - public IChatComponent getChatComponent() { - return new ChatComponentText("" + this.getEnergyValue()); + return new ChatComponentText("" + this.getValue()); } public NBTTagCompound writeToNBT(NBTTagCompound nbtTagCompound) diff --git a/src/main/java/com/pahimar/ee3/api/EnergyValueRegistryProxy.java b/src/main/java/com/pahimar/ee3/api/EnergyValueRegistryProxy.java index f46fcd47..b626d128 100644 --- a/src/main/java/com/pahimar/ee3/api/EnergyValueRegistryProxy.java +++ b/src/main/java/com/pahimar/ee3/api/EnergyValueRegistryProxy.java @@ -10,14 +10,9 @@ public final class EnergyValueRegistryProxy @Mod.Instance("EE3") private static Object ee3Mod; - public static void addPreAssignedEnergyValue(Object object, int energyValue) + public static void addPreAssignedEnergyValue(Object object, Number energyValue) { - addPreAssignedEnergyValue(object, new EnergyValue(energyValue)); - } - - public static void addPreAssignedEnergyValue(Object object, float energyValue) - { - addPreAssignedEnergyValue(object, new EnergyValue(energyValue)); + addPreAssignedEnergyValue(object, new EnergyValue(energyValue.floatValue())); } public static void addPreAssignedEnergyValue(Object object, EnergyValue energyValue) @@ -30,14 +25,9 @@ public final class EnergyValueRegistryProxy } } - public static void addPostAssignedEnergyValue(Object object, int energyValue) + public static void addPostAssignedEnergyValue(Object object, Number energyValue) { - addPostAssignedEnergyValue(object, new EnergyValue(energyValue)); - } - - public static void addPostAssignedEnergyValue(Object object, float energyValue) - { - addPostAssignedEnergyValue(object, new EnergyValue(energyValue)); + addPostAssignedEnergyValue(object, new EnergyValue(energyValue.floatValue())); } public static void addPostAssignedEnergyValue(Object object, EnergyValue energyValue) @@ -84,15 +74,26 @@ public final class EnergyValueRegistryProxy return null; } - - public static List getStacksInRange(int start, int finish) + public static EnergyValue getEnergyValueForStack(Object object) { - return getStacksInRange(new EnergyValue(start), new EnergyValue(finish)); + return getEnergyValueForStack(object, false); } - public static List getStacksInRange(float start, float finish) + public static EnergyValue getEnergyValueForStack(Object object, boolean strict) { - return getStacksInRange(new EnergyValue(start), new EnergyValue(finish)); + init(); + + if (ee3Mod != null) + { + return EE3Wrapper.ee3mod.getEnergyValueRegistry().getEnergyValueForStack(object, strict); + } + + return null; + } + + public static List getStacksInRange(Number start, Number finish) + { + return getStacksInRange(new EnergyValue(start.floatValue()), new EnergyValue(finish.floatValue())); } public static List getStacksInRange(EnergyValue start, EnergyValue finish) diff --git a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiTransmutationTablet.java b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiTransmutationTablet.java index 3e381396..45611d88 100644 --- a/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiTransmutationTablet.java +++ b/src/main/java/com/pahimar/ee3/client/gui/inventory/GuiTransmutationTablet.java @@ -137,7 +137,7 @@ public class GuiTransmutationTablet extends GuiBase { super.drawGuiContainerForegroundLayer(x, y); fontRendererObj.drawString(String.format("%s:", StatCollector.translateToLocal(Messages.ENERGY_VALUE)), 8, 140, Integer.parseInt(Colors.PURE_WHITE, 16)); - fontRendererObj.drawString(String.format("%s", energyValueDecimalFormat.format(tileEntityTransmutationTablet.getStoredEnergyValue().getEnergyValue())), 8, 150, Integer.parseInt(Colors.PURE_WHITE, 16)); + fontRendererObj.drawString(String.format("%s", energyValueDecimalFormat.format(tileEntityTransmutationTablet.getAvailableEnergyValue().getValue())), 8, 150, Integer.parseInt(Colors.PURE_WHITE, 16)); } @Override diff --git a/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java b/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java index f840d088..692e2cdd 100644 --- a/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java +++ b/src/main/java/com/pahimar/ee3/client/handler/ItemTooltipEventHandler.java @@ -1,7 +1,7 @@ package com.pahimar.ee3.client.handler; import com.pahimar.ee3.api.EnergyValue; -import com.pahimar.ee3.exchange.EnergyValueRegistry; +import com.pahimar.ee3.api.EnergyValueRegistryProxy; import com.pahimar.ee3.exchange.WrappedStack; import com.pahimar.ee3.inventory.ContainerAlchemicalTome; import com.pahimar.ee3.reference.Messages; @@ -13,6 +13,8 @@ import cpw.mods.fml.relauncher.SideOnly; import net.minecraft.util.StatCollector; import net.minecraftforge.common.UsernameCache; import net.minecraftforge.event.entity.player.ItemTooltipEvent; +import net.minecraftforge.fluids.FluidContainerRegistry; +import net.minecraftforge.fluids.FluidStack; import org.lwjgl.input.Keyboard; import java.text.DecimalFormat; @@ -35,19 +37,30 @@ public class ItemTooltipEventHandler { if (Keyboard.isKeyDown(Keyboard.KEY_LSHIFT) || Keyboard.isKeyDown(Keyboard.KEY_RSHIFT) || (event.entityPlayer != null && event.entityPlayer.openContainer instanceof ContainerAlchemicalTome)) { - WrappedStack stack = new WrappedStack(event.itemStack); + WrappedStack wrappedItemStack = WrappedStack.wrap(event.itemStack); + EnergyValue energyValue = EnergyValueRegistryProxy.getEnergyValue(wrappedItemStack); - if (EnergyValueRegistry.getInstance().getEnergyValue(stack) != null) + if (energyValue != null) { - EnergyValue energyValue = EnergyValueRegistry.getInstance().getEnergyValue(stack); - if (stack.getStackSize() > 1) + if (wrappedItemStack.getStackSize() > 1) { - event.toolTip.add(String.format("Exchange Energy (Item): %s", energyValueDecimalFormat.format(energyValue.getEnergyValue()))); // TODO Localize - event.toolTip.add(String.format("Exchange Energy (Stack of %s): %s", event.itemStack.stackSize, energyValueDecimalFormat.format(stack.getStackSize() * energyValue.getEnergyValue()))); // TODO Localize + event.toolTip.add(String.format("Exchange Energy (Item): %s", energyValueDecimalFormat.format(energyValue.getValue()))); // TODO Localize + event.toolTip.add(String.format("Exchange Energy (Stack of %s): %s", event.itemStack.stackSize, energyValueDecimalFormat.format(wrappedItemStack.getStackSize() * energyValue.getValue()))); // TODO Localize } else { - event.toolTip.add(String.format("Exchange Energy: %s", energyValueDecimalFormat.format(stack.getStackSize() * energyValue.getEnergyValue()))); // TODO Localize + event.toolTip.add(String.format("Exchange Energy: %s", energyValueDecimalFormat.format(wrappedItemStack.getStackSize() * energyValue.getValue()))); // TODO Localize + if (FluidContainerRegistry.getFluidForFilledItem(event.itemStack) != null) + { + FluidStack fluidStack = FluidContainerRegistry.getFluidForFilledItem(event.itemStack); + + if (EnergyValueRegistryProxy.getEnergyValueForStack(fluidStack) != null) + { + EnergyValue fluidStackEnergyValue = EnergyValueRegistryProxy.getEnergyValueForStack(fluidStack); + event.toolTip.add(String.format(" - Exchange Energy (%s): %s", fluidStack.getLocalizedName(), energyValueDecimalFormat.format(fluidStackEnergyValue.getValue()))); // TODO Localize + event.toolTip.add(String.format(" - Exchange Energy (Container): %s", energyValueDecimalFormat.format(energyValue.getValue() - fluidStackEnergyValue.getValue()))); // TODO Localize + } + } } } else diff --git a/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValue.java b/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValue.java index 51cfaaf7..44849e4b 100644 --- a/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValue.java +++ b/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValue.java @@ -88,10 +88,10 @@ public class CommandSetEnergyValue extends CommandBase } } - WrappedStack wrappedStack = new WrappedStack(itemStack); + WrappedStack wrappedStack = WrappedStack.wrap(itemStack); EnergyValue newEnergyValue = new EnergyValue(energyValue); - if (wrappedStack != null && newEnergyValue != null && Float.compare(newEnergyValue.getEnergyValue(), 0) > 0) + if (wrappedStack != null && newEnergyValue != null && Float.compare(newEnergyValue.getValue(), 0) > 0) { if (args[1].equalsIgnoreCase("pre")) { diff --git a/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValueCurrentItem.java b/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValueCurrentItem.java index 18dab31f..961a5916 100644 --- a/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValueCurrentItem.java +++ b/src/main/java/com/pahimar/ee3/command/CommandSetEnergyValueCurrentItem.java @@ -58,10 +58,10 @@ public class CommandSetEnergyValueCurrentItem extends CommandBase if (itemStack != null) { - WrappedStack wrappedStack = new WrappedStack(itemStack); + WrappedStack wrappedStack = WrappedStack.wrap(itemStack); EnergyValue newEnergyValue = new EnergyValue(energyValue); - if (wrappedStack != null && newEnergyValue != null && Float.compare(newEnergyValue.getEnergyValue(), 0) > 0) + if (wrappedStack != null && newEnergyValue != null && Float.compare(newEnergyValue.getValue(), 0) > 0) { if (args[1].equalsIgnoreCase("pre")) { diff --git a/src/main/java/com/pahimar/ee3/exchange/CachedOreDictionary.java b/src/main/java/com/pahimar/ee3/exchange/CachedOreDictionary.java index cf079709..bb4f4c6d 100644 --- a/src/main/java/com/pahimar/ee3/exchange/CachedOreDictionary.java +++ b/src/main/java/com/pahimar/ee3/exchange/CachedOreDictionary.java @@ -33,7 +33,7 @@ public class CachedOreDictionary for (ItemStack itemStack : oreNameItemStacks) { - stackToNameMultiMap.put(new WrappedStack(itemStack), oreName); + stackToNameMultiMap.put(WrappedStack.wrap(itemStack), oreName); } } @@ -70,7 +70,7 @@ public class CachedOreDictionary public List getOreNamesForItemStack(ItemStack itemStack) { List oreNameList = new ArrayList(); - WrappedStack wrappedStack = new WrappedStack(itemStack); + WrappedStack wrappedStack = WrappedStack.wrap(itemStack); if (itemStackToOreNameMap.containsKey(wrappedStack)) { diff --git a/src/main/java/com/pahimar/ee3/exchange/DynamicEnergyValueInitThread.java b/src/main/java/com/pahimar/ee3/exchange/DynamicEnergyValueInitThread.java index 0635b773..cc80b3c9 100644 --- a/src/main/java/com/pahimar/ee3/exchange/DynamicEnergyValueInitThread.java +++ b/src/main/java/com/pahimar/ee3/exchange/DynamicEnergyValueInitThread.java @@ -8,7 +8,7 @@ public class DynamicEnergyValueInitThread implements Runnable public static void initEnergyValueRegistry() { - new Thread(instance, "DynamicEV Thread").start(); + new Thread(instance, "DynamicEMC Thread").start(); } @Override @@ -16,6 +16,6 @@ public class DynamicEnergyValueInitThread implements Runnable { long startTime = System.currentTimeMillis(); EnergyValueRegistry.getInstance().init(); - LogHelper.info(String.format("DynamicEV system initialized after %s ms", System.currentTimeMillis() - startTime)); + LogHelper.info(String.format("DynamicEMC system initialized after %s ms", System.currentTimeMillis() - startTime)); } } diff --git a/src/main/java/com/pahimar/ee3/exchange/EnergyValueRegistry.java b/src/main/java/com/pahimar/ee3/exchange/EnergyValueRegistry.java index ea5df574..fba2dbb1 100644 --- a/src/main/java/com/pahimar/ee3/exchange/EnergyValueRegistry.java +++ b/src/main/java/com/pahimar/ee3/exchange/EnergyValueRegistry.java @@ -51,7 +51,7 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer(); } - if (WrappedStack.canBeWrapped(object) && energyValue != null && Float.compare(energyValue.getEnergyValue(), 0f) > 0) + if (WrappedStack.canBeWrapped(object) && energyValue != null && Float.compare(energyValue.getValue(), 0f) > 0) { - WrappedStack wrappedStack = new WrappedStack(object); + WrappedStack wrappedStack = WrappedStack.wrap(object); if (wrappedStack.getStackSize() > 0) { - WrappedStack factoredWrappedStack = new WrappedStack(wrappedStack, 1); + WrappedStack factoredWrappedStack = WrappedStack.wrap(wrappedStack, 1); EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize()); if (preAssignedMappings.containsKey(factoredWrappedStack)) @@ -87,7 +87,7 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer(); } - if (WrappedStack.canBeWrapped(object) && energyValue != null && Float.compare(energyValue.getEnergyValue(), 0f) > 0) + if (WrappedStack.canBeWrapped(object) && energyValue != null && Float.compare(energyValue.getValue(), 0f) > 0) { - WrappedStack wrappedStack = new WrappedStack(object); + WrappedStack wrappedStack = WrappedStack.wrap(object); if (wrappedStack.getStackSize() > 0) { - WrappedStack factoredWrappedStack = new WrappedStack(wrappedStack, 1); + WrappedStack factoredWrappedStack = WrappedStack.wrap(wrappedStack, 1); EnergyValue factoredEnergyValue = EnergyValueHelper.factorEnergyValue(energyValue, wrappedStack.getStackSize()); postAssignedMappings.put(factoredWrappedStack, factoredEnergyValue); @@ -133,6 +133,23 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer stackEnergyValueMap, Object object) { return getEnergyValueFromMap(stackEnergyValueMap, object, false); @@ -142,8 +159,8 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer 0f) + if (energyValue != null && energyValue.getValue() > 0f) { return energyValue; } @@ -179,17 +196,47 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer= 1) { - OreStack oreStack = new OreStack(OreDictionary.getOreName(OreDictionary.getOreIDs(wrappedItemStack)[0])); + EnergyValue energyValue = null; + boolean allHaveSameValueFlag = true; - if (stackEnergyValueMap.containsKey(new WrappedStack(oreStack))) + // Scan all valid ore dictionary values, if they ALL have the same value, then return it + for (int oreID : OreDictionary.getOreIDs(wrappedItemStack)) { - return stackEnergyValueMap.get(new WrappedStack(oreStack)); + String oreName = OreDictionary.getOreName(oreID); + if (!oreName.equals("Unknown")) + { + WrappedStack oreStack = WrappedStack.wrap(new OreStack(oreName)); + + if (oreStack != null && stackEnergyValueMap.containsKey(oreStack)) + { + if (energyValue == null) + { + energyValue = stackEnergyValueMap.get(oreStack); + } + else if (!energyValue.equals(stackEnergyValueMap.get(oreStack))) + { + allHaveSameValueFlag = false; + } + } + else + { + allHaveSameValueFlag = false; + } + } + else + { + allHaveSameValueFlag = false; + } + } + + if (energyValue != null && allHaveSameValueFlag) + { + return energyValue; } } else @@ -218,7 +265,7 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer= 1) + { + EnergyValue energyValue = null; + boolean allHaveSameValueFlag = true; + + // Scan all valid ore dictionary values, if they ALL have the same value, then return it + for (ItemStack itemStack : CachedOreDictionary.getInstance().getItemStacksForOreName(oreStack.oreName)) + { + WrappedStack wrappedItemStack = WrappedStack.wrap(itemStack); + + if (wrappedItemStack != null && stackEnergyValueMap.containsKey(wrappedItemStack)) + { + if (energyValue == null) + { + energyValue = stackEnergyValueMap.get(wrappedItemStack); + } + else if (!energyValue.equals(stackEnergyValueMap.get(wrappedItemStack))) + { + allHaveSameValueFlag = false; + } + } + else + { + allHaveSameValueFlag = false; + } + } + + if (energyValue != null && allHaveSameValueFlag) + { + return energyValue; + } + } + } } } } @@ -318,10 +391,10 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer 0) { - if (computedStackValues.get(keyStack) != null && Float.compare(computedStackValues.get(keyStack).getEnergyValue(), 0f) > 0) + if (computedStackValues.get(keyStack) != null && Float.compare(computedStackValues.get(keyStack).getValue(), 0f) > 0) { factoredExchangeEnergyValue = EnergyValueHelper.factorEnergyValue(computedStackValues.get(keyStack), keyStack.getStackSize()); - factoredKeyStack = new WrappedStack(keyStack, 1); + factoredKeyStack = WrappedStack.wrap(keyStack, 1); } } @@ -440,9 +513,9 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer 0f)) + if ((lowestValue != null) && (lowestValue.getValue() > 0f)) { - computedStackMap.put(new WrappedStack(recipeOutput.getWrappedObject()), lowestValue); + computedStackMap.put(WrappedStack.wrap(recipeOutput.getWrappedObject()), lowestValue); } } } @@ -568,7 +641,7 @@ public class EnergyValueRegistry implements INBTTaggable, JsonSerializer 0) + if (wrappedStack != null && energyValue != null && Float.compare(energyValue.getValue(), 0f) > 0) { TreeMap stackValueMap = new TreeMap(); diff --git a/src/main/java/com/pahimar/ee3/exchange/WrappedStack.java b/src/main/java/com/pahimar/ee3/exchange/WrappedStack.java index d2cfb8e2..66cb747d 100644 --- a/src/main/java/com/pahimar/ee3/exchange/WrappedStack.java +++ b/src/main/java/com/pahimar/ee3/exchange/WrappedStack.java @@ -30,7 +30,7 @@ public class WrappedStack implements Comparable, JsonDeserializer< wrappedStack = null; } - public WrappedStack(Object object) + private WrappedStack(Object object) { if (object instanceof Item) { @@ -128,7 +128,7 @@ public class WrappedStack implements Comparable, JsonDeserializer< } } - public WrappedStack(Object object, int stackSize) + private WrappedStack(Object object, int stackSize) { if (object instanceof Item) { @@ -331,6 +331,26 @@ public class WrappedStack implements Comparable, JsonDeserializer< return new WrappedStack(); } + public static WrappedStack wrap(Object object) + { + if (canBeWrapped(object)) + { + return new WrappedStack(object); + } + + return null; + } + + public static WrappedStack wrap(Object object, int stackSize) + { + if (canBeWrapped(object)) + { + return new WrappedStack(object, stackSize); + } + + return null; + } + public static WrappedStack createFromJson(String jsonWrappedObject) throws JsonParseException { try @@ -560,7 +580,15 @@ public class WrappedStack implements Comparable, JsonDeserializer< { if (wrappedStack instanceof ItemStack) { - return ItemHelper.toString((ItemStack) wrappedStack); + ItemStack itemStack = (ItemStack) wrappedStack; + if (itemStack.hasTagCompound()) + { + return String.format("%sxitemStack[%s@%s:%s]", stackSize, itemStack.getUnlocalizedName(), itemStack.getItemDamage(), itemStack.getTagCompound()); + } + else + { + return String.format("%sxitemStack[%s@%s]", stackSize, itemStack.getUnlocalizedName(), itemStack.getItemDamage()); + } } else if (wrappedStack instanceof OreStack) { @@ -574,7 +602,7 @@ public class WrappedStack implements Comparable, JsonDeserializer< } else { - return "null"; + return "null-wrappedstack"; } } diff --git a/src/main/java/com/pahimar/ee3/init/EnergyValues.java b/src/main/java/com/pahimar/ee3/init/EnergyValues.java index b294f14c..32de5170 100644 --- a/src/main/java/com/pahimar/ee3/init/EnergyValues.java +++ b/src/main/java/com/pahimar/ee3/init/EnergyValues.java @@ -2,7 +2,6 @@ package com.pahimar.ee3.init; import com.pahimar.ee3.api.EnergyValueRegistryProxy; import com.pahimar.ee3.exchange.OreStack; -import com.pahimar.ee3.exchange.WrappedStack; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; @@ -14,173 +13,157 @@ public class EnergyValues public static void addDefaultEnergyValues() { // OreDictionary assignment - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("cobblestone")), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("stone")), 1); - + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("cobblestone"), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("dustRedstone"), 32); String[] dyes = {"Black", "Red", "Green", "Brown", "Blue", "Purple", "Cyan", "LightGray", "Gray", "Pink", "Lime", "Yellow", "LightBlue", "Magenta", "Orange", "White"}; for (int i = 0; i < dyes.length; i++) { - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("dye" + dyes[i])), 8); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("dye" + dyes[i]), 16); } - - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("logWood")), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreDiamond")), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("gemDiamond")), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreEmerald")), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("gemEmerald")), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreGold")), 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("ingotGold")), 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreIron")), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("ingotIron")), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreLapis")), 864); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("gemLapis")), 864); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreQuartz")), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("gemQuartz")), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("oreRedstone")), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("plankWood")), 8); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("record")), 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("slabWood")), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("stairWood")), 12); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("stickWood")), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("treeLeaves")), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("treeSapling")), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("sandstone")), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new OreStack("sand")), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("gemDiamond"), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("gemEmerald"), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("gemLapis"), 864); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("gemQuartz"), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("ingotGold"), 2048); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("ingotIron"), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("logWood"), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreCoal"), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreDiamond"), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreEmerald"), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreGold"), 2048); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreIron"), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreLapis"), 864); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreQuartz"), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("oreRedstone"), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("plankWood"), 8); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("record"), 2048); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("sand"), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("sandstone"), 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("slabWood"), 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("stairWood"), 12); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("stickWood"), 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("stone"), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("treeLeaves"), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new OreStack("treeSapling"), 32); // Fluids - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(FluidRegistry.WATER), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(FluidRegistry.LAVA), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(FluidRegistry.getFluid("milk")), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(FluidRegistry.WATER, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(FluidRegistry.LAVA, 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(FluidRegistry.getFluid("milk"), 64); /* Building Blocks */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.stone), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.grass), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.dirt, 1, OreDictionary.WILDCARD_VALUE)), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.cobblestone), 1); - // Bedrock - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.sand, 1, OreDictionary.WILDCARD_VALUE)), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.gravel), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.coal_ore), 32); - // Sponge - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.glass), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE)), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.mossy_cobblestone), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.obsidian), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.ice), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.pumpkin), 144); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.netherrack), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.soul_sand), 49); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.stonebrick, 1, OreDictionary.WILDCARD_VALUE)), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.mycelium), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.end_stone), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.hardened_clay), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.stone, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.grass, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.dirt, 1, OreDictionary.WILDCARD_VALUE), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.cobblestone, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.sand, 1, OreDictionary.WILDCARD_VALUE), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.gravel, 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.glass, 1, OreDictionary.WILDCARD_VALUE), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.sandstone, 1, OreDictionary.WILDCARD_VALUE), 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.mossy_cobblestone, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.obsidian, 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.ice, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.pumpkin, 144); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.netherrack, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.soul_sand, 49); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.stonebrick, 1, OreDictionary.WILDCARD_VALUE), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.mycelium, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.end_stone, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.hardened_clay, 256); /* Decoration Blocks */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.web), 12); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.tallgrass, 1, OreDictionary.WILDCARD_VALUE)), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.deadbush), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.yellow_flower), 16); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.red_flower, 1, OreDictionary.WILDCARD_VALUE)), 16); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.brown_mushroom), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.red_mushroom), 32); - // Snow Layer - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.cactus), 8); - // Stone Monster Egg - // Cobblestone Monster Egg - // Stone Brick Monster Egg - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.vine), 8); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Blocks.waterlily), 16); - // End Portal - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Blocks.double_plant, 1, OreDictionary.WILDCARD_VALUE)), 16); - // Skeleton Skull - // Wither Skeleton Skull - // Zombie Head - // Head - // Creeper Head + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.web, 12); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.tallgrass, 1, OreDictionary.WILDCARD_VALUE), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.deadbush, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.yellow_flower, 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.red_flower, 1, OreDictionary.WILDCARD_VALUE), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.brown_mushroom, 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.red_mushroom, 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.red_mushroom, 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.snow_layer, 0.125); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.cactus, 8); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.vine, 8); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Blocks.waterlily, 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.anvil, 1, 1), 5290.667f); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.anvil, 1, 2), 2645.333f); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Blocks.double_plant, 1, OreDictionary.WILDCARD_VALUE), 32); /* Redstone */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.redstone), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.redstone, 32); /* Transportation */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.saddle), 192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.saddle, 192); /* Miscellaneous */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.snowball), 0.25f); - // Milk - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.slime_ball), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.bone), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.ender_pearl), 1024); - // Bottle o'Enchanting - // Firework Star + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.snowball, 0.25f); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.slime_ball, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.bone, 48); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.ender_pearl, 1024); /* Foodstuffs */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.apple), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.porkchop), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.cooked_porkchop), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE)), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Items.cooked_fished, 1, OreDictionary.WILDCARD_VALUE)), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.melon), 16); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.beef), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.cooked_beef), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.chicken), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.cooked_chicken), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.rotten_flesh), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.spider_eye), 128); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.carrot), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.potato), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.baked_potato), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.poisonous_potato), 24); - - /* Tools */ - // Name Tag - - /* Combat */ - // Chain Helmet - // Chain Chestplate - // Chain Leggings - // Chain Boots + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.apple, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.porkchop, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.cooked_porkchop, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.fish, 1, OreDictionary.WILDCARD_VALUE), 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.cooked_fished, 1, OreDictionary.WILDCARD_VALUE), 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.melon, 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.beef, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.cooked_beef, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.chicken, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.cooked_chicken, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.rotten_flesh, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.spider_eye, 128); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.carrot, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.potato, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.baked_potato, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.poisonous_potato, 24); /* Brewing */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.ghast_tear), 4096); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.ghast_tear, 4096); /* Materials */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Items.coal, 1, 0)), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Items.coal, 1, 1)), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.diamond), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.iron_ingot), 256); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.gold_ingot), 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.string), 12); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.feather), 48); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.gunpowder), 192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.wheat_seeds), 16); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.wheat), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.flint), 4); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.leather), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.brick), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.clay_ball), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.reeds), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.egg), 32); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.glowstone_dust), 384); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(Items.dye, 1, 4)), 864); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.blaze_rod), 1536); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.nether_wart), 24); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.emerald), 8192); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.nether_star), 24576); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.netherbrick), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(Items.quartz), 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.coal, 1, 0), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.coal, 1, 1), 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.diamond, 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.iron_ingot, 256); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.gold_ingot, 2048); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.string, 12); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.feather, 48); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.gunpowder, 192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.wheat_seeds, 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.wheat, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.flint, 4); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.leather, 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.brick, 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.clay_ball, 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.reeds, 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.egg, 32); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.glowstone_dust, 384); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 0), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 2), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 3), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 4), 864); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 5), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(Items.dye, 1, 6), 16); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.blaze_rod, 1536); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.nether_wart, 24); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.emerald, 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.nether_star, 24576); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.netherbrick, 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(Items.quartz, 256); /* Equivalent Exchange 3 */ /** * Alchemical Dusts */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 0)), 1); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 1)), 64); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 2)), 2048); - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(ModItems.alchemicalDust, 1, 3)), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ModItems.alchemicalDust, 1, 0), 1); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ModItems.alchemicalDust, 1, 1), 64); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ModItems.alchemicalDust, 1, 2), 2048); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ModItems.alchemicalDust, 1, 3), 8192); /** * Minium Shard */ - EnergyValueRegistryProxy.addPreAssignedEnergyValue(new WrappedStack(new ItemStack(ModItems.shardMinium)), 8192); + EnergyValueRegistryProxy.addPreAssignedEnergyValue(new ItemStack(ModItems.shardMinium), 8192); } } diff --git a/src/main/java/com/pahimar/ee3/inventory/ContainerTransmutationTablet.java b/src/main/java/com/pahimar/ee3/inventory/ContainerTransmutationTablet.java index df645372..d23dd75d 100644 --- a/src/main/java/com/pahimar/ee3/inventory/ContainerTransmutationTablet.java +++ b/src/main/java/com/pahimar/ee3/inventory/ContainerTransmutationTablet.java @@ -54,7 +54,7 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen this.sortOrder = 0; this.scrollBarPosition = 0; - this.energyValue = tileEntityTransmutationTablet.getStoredEnergyValue().getEnergyValue(); + this.energyValue = tileEntityTransmutationTablet.getAvailableEnergyValue().getValue(); this.addSlotToContainer(new SlotTabletInput(this, tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_1, 62, 24)); this.addSlotToContainer(new SlotTabletInput(this, tileEntityTransmutationTablet, TileEntityTransmutationTablet.ITEM_INPUT_2, 35, 35)); @@ -115,11 +115,11 @@ public class ContainerTransmutationTablet extends ContainerEE implements IElemen { ICrafting iCrafting = (ICrafting) crafter; - if (this.energyValue != this.tileEntityTransmutationTablet.getStoredEnergyValue().getEnergyValue()) + if (this.energyValue != this.tileEntityTransmutationTablet.getAvailableEnergyValue().getValue()) { - this.energyValue = this.tileEntityTransmutationTablet.getStoredEnergyValue().getEnergyValue(); + this.energyValue = this.tileEntityTransmutationTablet.getAvailableEnergyValue().getValue(); this.updateInventory(); - int energyValueAsInt = Float.floatToRawIntBits(this.tileEntityTransmutationTablet.getStoredEnergyValue().getEnergyValue()); + int energyValueAsInt = Float.floatToRawIntBits(this.tileEntityTransmutationTablet.getAvailableEnergyValue().getValue()); iCrafting.sendProgressBarUpdate(this, 0, energyValueAsInt & 0xffff); iCrafting.sendProgressBarUpdate(this, 1, energyValueAsInt >>> 16); } diff --git a/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java b/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java index 9b5d5c48..463bc795 100644 --- a/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java +++ b/src/main/java/com/pahimar/ee3/item/crafting/RecipeAludel.java @@ -17,13 +17,13 @@ public class RecipeAludel public RecipeAludel(ItemStack recipeOutput, ItemStack inputStack, ItemStack dustStack) { this.recipeOutput = recipeOutput.copy(); - this.inputStack = new WrappedStack(inputStack); + this.inputStack = WrappedStack.wrap(inputStack); this.dustStack = dustStack.copy(); } public boolean matches(ItemStack inputStack, ItemStack dustStack) { - return matches(new WrappedStack(inputStack), dustStack); + return matches(WrappedStack.wrap(inputStack), dustStack); } public boolean matches(WrappedStack inputStack, ItemStack dustStack) @@ -82,14 +82,14 @@ public class RecipeAludel public WrappedStack[] getRecipeInputs() { - return new WrappedStack[]{inputStack, new WrappedStack(dustStack)}; + return new WrappedStack[]{inputStack, WrappedStack.wrap(dustStack)}; } public List getRecipeInputsAsWrappedStacks() { List recipeInputs = new ArrayList(); - recipeInputs.add(new WrappedStack(inputStack)); - recipeInputs.add(new WrappedStack(dustStack)); + recipeInputs.add(WrappedStack.wrap(inputStack)); + recipeInputs.add(WrappedStack.wrap(dustStack)); return recipeInputs; } diff --git a/src/main/java/com/pahimar/ee3/knowledge/AbilityRegistry.java b/src/main/java/com/pahimar/ee3/knowledge/AbilityRegistry.java index 8d640e6e..8a8ddb0f 100644 --- a/src/main/java/com/pahimar/ee3/knowledge/AbilityRegistry.java +++ b/src/main/java/com/pahimar/ee3/knowledge/AbilityRegistry.java @@ -92,7 +92,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - WrappedStack wrappedObject = new WrappedStack(object); + WrappedStack wrappedObject = WrappedStack.wrap(object); return !notLearnableSet.contains(wrappedObject) && EnergyValueRegistry.getInstance().hasEnergyValue(wrappedObject); } @@ -103,7 +103,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - hasBeenModified = notLearnableSet.remove(new WrappedStack(object)); + hasBeenModified = notLearnableSet.remove(WrappedStack.wrap(object)); } } @@ -111,7 +111,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - hasBeenModified = notLearnableSet.add(new WrappedStack(object)); + hasBeenModified = notLearnableSet.add(WrappedStack.wrap(object)); } } @@ -124,7 +124,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - WrappedStack wrappedObject = new WrappedStack(object); + WrappedStack wrappedObject = WrappedStack.wrap(object); return !notRecoverableSet.contains(wrappedObject) && EnergyValueRegistry.getInstance().hasEnergyValue(wrappedObject); } @@ -135,7 +135,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - hasBeenModified = notRecoverableSet.remove(new WrappedStack(object)); + hasBeenModified = notRecoverableSet.remove(WrappedStack.wrap(object)); } } @@ -143,7 +143,7 @@ public class AbilityRegistry implements JsonSerializer, JsonDes { if (WrappedStack.canBeWrapped(object)) { - hasBeenModified = notRecoverableSet.add(new WrappedStack(object)); + hasBeenModified = notRecoverableSet.add(WrappedStack.wrap(object)); } } diff --git a/src/main/java/com/pahimar/ee3/nei/CalcinationHandler.java b/src/main/java/com/pahimar/ee3/nei/CalcinationHandler.java index 6e46ccd1..c2d6e595 100644 --- a/src/main/java/com/pahimar/ee3/nei/CalcinationHandler.java +++ b/src/main/java/com/pahimar/ee3/nei/CalcinationHandler.java @@ -180,7 +180,7 @@ public class CalcinationHandler extends TemplateRecipeHandler if (cRecipe != null && cRecipe.minEnergyValue != null && cRecipe.maxEnergyValue != null && EnergyValueRegistryProxy.getEnergyValue(ItemAlchemicalDust.getAlchemicalDusts().get(ItemAlchemicalDust.getAlchemicalDusts().size() - 1)) != null) { - drawStringC(StatCollector.translateToLocalFormatted("gui.nei.ee3:calcination.tooltip.2", (cRecipe.minEnergyValue.getEnergyValue() > 1 ? energyValueDecimalFormat.format(cRecipe.minEnergyValue.getEnergyValue()) : "0"), (cRecipe.maxEnergyValue.getEnergyValue() <= EnergyValueRegistryProxy.getEnergyValue(ItemAlchemicalDust.getAlchemicalDusts().get(ItemAlchemicalDust.getAlchemicalDusts().size() - 1)).getEnergyValue() ? energyValueDecimalFormat.format(cRecipe.maxEnergyValue.getEnergyValue()) : "\u221E")), 83, 95, 0x404040, false); + drawStringC(StatCollector.translateToLocalFormatted("gui.nei.ee3:calcination.tooltip.2", (cRecipe.minEnergyValue.getValue() > 1 ? energyValueDecimalFormat.format(cRecipe.minEnergyValue.getValue()) : "0"), (cRecipe.maxEnergyValue.getValue() <= EnergyValueRegistryProxy.getEnergyValue(ItemAlchemicalDust.getAlchemicalDusts().get(ItemAlchemicalDust.getAlchemicalDusts().size() - 1)).getValue() ? energyValueDecimalFormat.format(cRecipe.maxEnergyValue.getValue()) : "\u221E")), 83, 95, 0x404040, false); } } diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java b/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java index f76235a6..4773020a 100644 --- a/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java +++ b/src/main/java/com/pahimar/ee3/recipe/RecipeRegistry.java @@ -33,27 +33,25 @@ public class RecipeRegistry public void addRecipe(Object recipeOutput, List recipeInputList) { - // Verify that the recipe output object can be wrapped - if (!WrappedStack.canBeWrapped(recipeOutput)) + // Wrap the recipe output + WrappedStack wrappedRecipeOutput = WrappedStack.wrap(recipeOutput); + if (wrappedRecipeOutput == null) { return; } - // Verify that every recipe input object can be wrapped - for (Object recipeInputObject : recipeInputList) - { - if (!WrappedStack.canBeWrapped(recipeInputObject)) - { - return; - } - } - - // Wrap the recipe output - WrappedStack wrappedRecipeOutput = new WrappedStack(recipeOutput); List wrappedRecipeInputList = new ArrayList(); for (Object recipeInputObject : recipeInputList) { - wrappedRecipeInputList.add(new WrappedStack(recipeInputObject)); + WrappedStack wrappedInputObject = WrappedStack.wrap(recipeInputObject); + if (wrappedInputObject != null) + { + wrappedRecipeInputList.add(wrappedInputObject); + } + else + { + return; + } } // Add the recipe mapping only if we don't already have it diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java b/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java index 94b4373d..6325254f 100644 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java +++ b/src/main/java/com/pahimar/ee3/recipe/RecipesPotions.java @@ -10,92 +10,92 @@ import java.util.Arrays; public class RecipesPotions { - private static WrappedStack reagentWater = new WrappedStack(new ItemStack(Blocks.water)); - private static WrappedStack reagentNetherWart = new WrappedStack(new ItemStack(Items.nether_wart)); - private static WrappedStack reagentGlowstoneDust = new WrappedStack(new ItemStack(Items.glowstone_dust)); - private static WrappedStack reagentRedstoneDust = new WrappedStack(new ItemStack(Items.redstone)); - private static WrappedStack reagentGunpowder = new WrappedStack(new ItemStack(Items.gunpowder)); - private static WrappedStack reagentGoldenCarrot = new WrappedStack(new ItemStack(Items.golden_carrot)); - private static WrappedStack reagentMagmaCream = new WrappedStack(new ItemStack(Items.magma_cream)); - private static WrappedStack reagentSugar = new WrappedStack(new ItemStack(Items.sugar)); - private static WrappedStack reagentGlisteringMelon = new WrappedStack(new ItemStack(Items.speckled_melon)); - private static WrappedStack reagentSpiderEye = new WrappedStack(new ItemStack(Items.spider_eye)); - private static WrappedStack reagentGhastTear = new WrappedStack(new ItemStack(Items.ghast_tear)); - private static WrappedStack reagentFermentedSpiderEye = new WrappedStack(new ItemStack(Items.fermented_spider_eye)); - private static WrappedStack reagentBlazePowder = new WrappedStack(new ItemStack(Items.blaze_powder)); + private static WrappedStack reagentWater = WrappedStack.wrap(new ItemStack(Blocks.water)); + private static WrappedStack reagentNetherWart = WrappedStack.wrap(new ItemStack(Items.nether_wart)); + private static WrappedStack reagentGlowstoneDust = WrappedStack.wrap(new ItemStack(Items.glowstone_dust)); + private static WrappedStack reagentRedstoneDust = WrappedStack.wrap(new ItemStack(Items.redstone)); + private static WrappedStack reagentGunpowder = WrappedStack.wrap(new ItemStack(Items.gunpowder)); + private static WrappedStack reagentGoldenCarrot = WrappedStack.wrap(new ItemStack(Items.golden_carrot)); + private static WrappedStack reagentMagmaCream = WrappedStack.wrap(new ItemStack(Items.magma_cream)); + private static WrappedStack reagentSugar = WrappedStack.wrap(new ItemStack(Items.sugar)); + private static WrappedStack reagentGlisteringMelon = WrappedStack.wrap(new ItemStack(Items.speckled_melon)); + private static WrappedStack reagentSpiderEye = WrappedStack.wrap(new ItemStack(Items.spider_eye)); + private static WrappedStack reagentGhastTear = WrappedStack.wrap(new ItemStack(Items.ghast_tear)); + private static WrappedStack reagentFermentedSpiderEye = WrappedStack.wrap(new ItemStack(Items.fermented_spider_eye)); + private static WrappedStack reagentBlazePowder = WrappedStack.wrap(new ItemStack(Items.blaze_powder)); - private static WrappedStack bottleEmpty = new WrappedStack(Items.glass_bottle); - public static WrappedStack bottleWater = new WrappedStack(new ItemStack(Items.potionitem, 1, 0)); + private static WrappedStack bottleEmpty = WrappedStack.wrap(Items.glass_bottle); + public static WrappedStack bottleWater = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 0)); - public static WrappedStack potionAwkward = new WrappedStack(new ItemStack(Items.potionitem, 1, 16)); - public static WrappedStack potionThick = new WrappedStack(new ItemStack(Items.potionitem, 1, 32)); - public static WrappedStack potionMundane = new WrappedStack(new ItemStack(Items.potionitem, 1, 128)); - public static WrappedStack potionMundaneExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 64)); - public static WrappedStack potionMundaneSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16512)); - public static WrappedStack potionMundaneSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16448)); + public static WrappedStack potionAwkward = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16)); + public static WrappedStack potionThick = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 32)); + public static WrappedStack potionMundane = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 128)); + public static WrappedStack potionMundaneExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 64)); + public static WrappedStack potionMundaneSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16512)); + public static WrappedStack potionMundaneSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16448)); - public static WrappedStack potionRegeneration = new WrappedStack(new ItemStack(Items.potionitem, 1, 8193)); - public static WrappedStack potionRegenerationEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8225)); - public static WrappedStack potionRegenerationExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8257)); - public static WrappedStack potionRegenerationSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16385)); - public static WrappedStack potionRegenerationSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16417)); - public static WrappedStack potionRegenerationSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16449)); + public static WrappedStack potionRegeneration = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8193)); + public static WrappedStack potionRegenerationEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8225)); + public static WrappedStack potionRegenerationExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8257)); + public static WrappedStack potionRegenerationSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16385)); + public static WrappedStack potionRegenerationSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16417)); + public static WrappedStack potionRegenerationSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16449)); - public static WrappedStack potionSwiftness = new WrappedStack(new ItemStack(Items.potionitem, 1, 8194)); - public static WrappedStack potionSwiftnessEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8226)); - public static WrappedStack potionSwiftnessExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8258)); - public static WrappedStack potionSwiftnessSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16386)); - public static WrappedStack potionSwiftnessSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16418)); - public static WrappedStack potionSwiftnessSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16450)); + public static WrappedStack potionSwiftness = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8194)); + public static WrappedStack potionSwiftnessEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8226)); + public static WrappedStack potionSwiftnessExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8258)); + public static WrappedStack potionSwiftnessSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16386)); + public static WrappedStack potionSwiftnessSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16418)); + public static WrappedStack potionSwiftnessSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16450)); - public static WrappedStack potionFireResist = new WrappedStack(new ItemStack(Items.potionitem, 1, 8195)); - public static WrappedStack potionFireResistExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8259)); - public static WrappedStack potionFireResistSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16387)); - public static WrappedStack potionFireResistSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16451)); + public static WrappedStack potionFireResist = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8195)); + public static WrappedStack potionFireResistExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8259)); + public static WrappedStack potionFireResistSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16387)); + public static WrappedStack potionFireResistSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16451)); - public static WrappedStack potionPoison = new WrappedStack(new ItemStack(Items.potionitem, 1, 8196)); - public static WrappedStack potionPoisonEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8228)); - public static WrappedStack potionPoisonExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8260)); - public static WrappedStack potionPoisonSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16388)); - public static WrappedStack potionPoisonSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16420)); - public static WrappedStack potionPoisonSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16452)); + public static WrappedStack potionPoison = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8196)); + public static WrappedStack potionPoisonEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8228)); + public static WrappedStack potionPoisonExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8260)); + public static WrappedStack potionPoisonSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16388)); + public static WrappedStack potionPoisonSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16420)); + public static WrappedStack potionPoisonSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16452)); - public static WrappedStack potionHealing = new WrappedStack(new ItemStack(Items.potionitem, 1, 8197)); - public static WrappedStack potionHealingEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8229)); - public static WrappedStack potionHealingSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16389)); - public static WrappedStack potionHealingSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16421)); + public static WrappedStack potionHealing = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8197)); + public static WrappedStack potionHealingEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8229)); + public static WrappedStack potionHealingSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16389)); + public static WrappedStack potionHealingSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16421)); - public static WrappedStack potionNightVision = new WrappedStack(new ItemStack(Items.potionitem, 1, 8198)); - public static WrappedStack potionNightVisionExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8262)); - public static WrappedStack potionNightVisionSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16390)); - public static WrappedStack potionNightVisionSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16454)); + public static WrappedStack potionNightVision = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8198)); + public static WrappedStack potionNightVisionExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8262)); + public static WrappedStack potionNightVisionSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16390)); + public static WrappedStack potionNightVisionSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16454)); - public static WrappedStack potionWeakness = new WrappedStack(new ItemStack(Items.potionitem, 1, 8200)); - public static WrappedStack potionWeaknessExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8264)); - public static WrappedStack potionWeaknessSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16392)); - public static WrappedStack potionWeaknessSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16456)); + public static WrappedStack potionWeakness = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8200)); + public static WrappedStack potionWeaknessExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8264)); + public static WrappedStack potionWeaknessSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16392)); + public static WrappedStack potionWeaknessSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16456)); - public static WrappedStack potionStrength = new WrappedStack(new ItemStack(Items.potionitem, 1, 8201)); - public static WrappedStack potionStrengthEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8233)); - public static WrappedStack potionStrengthExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8265)); - public static WrappedStack potionStrengthSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16393)); - public static WrappedStack potionStrengthSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16425)); - public static WrappedStack potionStrengthSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16457)); + public static WrappedStack potionStrength = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8201)); + public static WrappedStack potionStrengthEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8233)); + public static WrappedStack potionStrengthExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8265)); + public static WrappedStack potionStrengthSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16393)); + public static WrappedStack potionStrengthSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16425)); + public static WrappedStack potionStrengthSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16457)); - public static WrappedStack potionSlowness = new WrappedStack(new ItemStack(Items.potionitem, 1, 8202)); - public static WrappedStack potionSlownessExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8266)); - public static WrappedStack potionSlownessSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16394)); - public static WrappedStack potionSlownessSplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16458)); + public static WrappedStack potionSlowness = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8202)); + public static WrappedStack potionSlownessExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8266)); + public static WrappedStack potionSlownessSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16394)); + public static WrappedStack potionSlownessSplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16458)); - public static WrappedStack potionHarming = new WrappedStack(new ItemStack(Items.potionitem, 1, 8204)); - public static WrappedStack potionHarmingEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 8236)); - public static WrappedStack potionHarmingSplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16396)); - public static WrappedStack potionHarmingSplashEnhanced = new WrappedStack(new ItemStack(Items.potionitem, 1, 16428)); + public static WrappedStack potionHarming = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8204)); + public static WrappedStack potionHarmingEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8236)); + public static WrappedStack potionHarmingSplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16396)); + public static WrappedStack potionHarmingSplashEnhanced = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16428)); - public static WrappedStack potionInvisibility = new WrappedStack(new ItemStack(Items.potionitem, 1, 8206)); - public static WrappedStack potionInvisibilityExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 8270)); - public static WrappedStack potionInvisibilitySplash = new WrappedStack(new ItemStack(Items.potionitem, 1, 16398)); - public static WrappedStack potionInvisibilitySplashExtended = new WrappedStack(new ItemStack(Items.potionitem, 1, 16462)); + public static WrappedStack potionInvisibility = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8206)); + public static WrappedStack potionInvisibilityExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 8270)); + public static WrappedStack potionInvisibilitySplash = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16398)); + public static WrappedStack potionInvisibilitySplashExtended = WrappedStack.wrap(new ItemStack(Items.potionitem, 1, 16462)); public static void registerRecipes() { diff --git a/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java b/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java index 30fbba2b..da7d8a93 100644 --- a/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java +++ b/src/main/java/com/pahimar/ee3/recipe/RecipesVanilla.java @@ -1,16 +1,20 @@ package com.pahimar.ee3.recipe; import com.pahimar.ee3.api.RecipeRegistryProxy; +import com.pahimar.ee3.exchange.OreStack; import com.pahimar.ee3.exchange.WrappedStack; import com.pahimar.ee3.util.RecipeHelper; +import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; +import net.minecraftforge.oredict.OreDictionary; import net.minecraftforge.oredict.ShapedOreRecipe; import net.minecraftforge.oredict.ShapelessOreRecipe; +import java.util.Arrays; import java.util.List; public class RecipesVanilla @@ -38,5 +42,12 @@ public class RecipesVanilla } } } + + // Fixes for OreDictionary entries that may not exist (because the OreDictionary entry has nothing in it) + RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.wool, 1, 11), Arrays.asList(new OreStack("dyeBlue"), Blocks.wool)); + RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_hardened_clay, 8, 11), Arrays.asList(new OreStack("dyeBlue"), new ItemStack(Blocks.hardened_clay, 8))); + RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_glass, 8, OreDictionary.WILDCARD_VALUE), Arrays.asList(new OreStack("dye"), new ItemStack(Blocks.glass, 8, OreDictionary.WILDCARD_VALUE))); + RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.stained_glass_pane, 16, OreDictionary.WILDCARD_VALUE), Arrays.asList(new ItemStack(Blocks.stained_glass, 6, OreDictionary.WILDCARD_VALUE))); + RecipeRegistryProxy.addRecipe(new ItemStack(Blocks.daylight_detector), Arrays.asList(new ItemStack(Blocks.glass, 3, OreDictionary.WILDCARD_VALUE), new OreStack("slabWood", 3), new OreStack("gemQuartz", 3))); } } diff --git a/src/main/java/com/pahimar/ee3/reference/Names.java b/src/main/java/com/pahimar/ee3/reference/Names.java index 4a09ab8b..7bb81693 100644 --- a/src/main/java/com/pahimar/ee3/reference/Names.java +++ b/src/main/java/com/pahimar/ee3/reference/Names.java @@ -55,6 +55,11 @@ public class Names public static final String POTION_LETHE = "potionLethe"; } + public static final class Fluids + { + public static final String MILK = "ee3.milk"; + } + public static final class Materials { public static final String DARK_MATTER = "matterDark"; diff --git a/src/main/java/com/pahimar/ee3/test/EnergyValueMappingsTestSuite.java b/src/main/java/com/pahimar/ee3/test/EnergyValueMappingsTestSuite.java index 8a2056c9..41905623 100644 --- a/src/main/java/com/pahimar/ee3/test/EnergyValueMappingsTestSuite.java +++ b/src/main/java/com/pahimar/ee3/test/EnergyValueMappingsTestSuite.java @@ -31,18 +31,21 @@ public class EnergyValueMappingsTestSuite public void add(Object object, Object value) { - if (WrappedStack.canBeWrapped(object) && value instanceof Number) + if (WrappedStack.canBeWrapped(object)) { - Number number = (Number) value; - WrappedStack wrappedStack = new WrappedStack(object); - wrappedStack.setStackSize(1); - testSuiteValueMap.put(wrappedStack, new EnergyValue(number.floatValue())); - } - else if (value == null) - { - WrappedStack wrappedStack = new WrappedStack(object); - wrappedStack.setStackSize(1); - testSuiteValueMap.put(wrappedStack, null); + if (value instanceof Number) + { + Number number = (Number) value; + WrappedStack wrappedStack = WrappedStack.wrap(object); + wrappedStack.setStackSize(1); + testSuiteValueMap.put(wrappedStack, new EnergyValue(number.floatValue())); + } + else if (value == null) + { + WrappedStack wrappedStack = WrappedStack.wrap(object); + wrappedStack.setStackSize(1); + testSuiteValueMap.put(wrappedStack, null); + } } } @@ -50,7 +53,7 @@ public class EnergyValueMappingsTestSuite { if (WrappedStack.canBeWrapped(object)) { - WrappedStack wrappedStack = new WrappedStack(object); + WrappedStack wrappedStack = WrappedStack.wrap(object); wrappedStack.setStackSize(1); testSuiteValueMap.remove(wrappedStack); } diff --git a/src/main/java/com/pahimar/ee3/test/VanillaEnergyValueTest.java b/src/main/java/com/pahimar/ee3/test/VanillaEnergyValueTest.java index 7c7cc1e9..6b9a4e4a 100644 --- a/src/main/java/com/pahimar/ee3/test/VanillaEnergyValueTest.java +++ b/src/main/java/com/pahimar/ee3/test/VanillaEnergyValueTest.java @@ -57,21 +57,21 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(new ItemStack(Blocks.sandstone, 1, 1), 4); add(new ItemStack(Blocks.sandstone, 1, 2), 4); add(new ItemStack(Blocks.wool, 1, 0), 48); - add(new ItemStack(Blocks.wool, 1, 1), 56); - add(new ItemStack(Blocks.wool, 1, 2), 56); - add(new ItemStack(Blocks.wool, 1, 3), 56); - add(new ItemStack(Blocks.wool, 1, 4), 56); - add(new ItemStack(Blocks.wool, 1, 5), 56); - add(new ItemStack(Blocks.wool, 1, 6), 56); - add(new ItemStack(Blocks.wool, 1, 7), 56); - add(new ItemStack(Blocks.wool, 1, 8), 56); - add(new ItemStack(Blocks.wool, 1, 9), 56); - add(new ItemStack(Blocks.wool, 1, 10), 56); - add(new ItemStack(Blocks.wool, 1, 11), 56); - add(new ItemStack(Blocks.wool, 1, 12), 56); - add(new ItemStack(Blocks.wool, 1, 13), 56); - add(new ItemStack(Blocks.wool, 1, 14), 56); - add(new ItemStack(Blocks.wool, 1, 15), 56); + add(new ItemStack(Blocks.wool, 1, 1), 64); + add(new ItemStack(Blocks.wool, 1, 2), 64); + add(new ItemStack(Blocks.wool, 1, 3), 64); + add(new ItemStack(Blocks.wool, 1, 4), 64); + add(new ItemStack(Blocks.wool, 1, 5), 64); + add(new ItemStack(Blocks.wool, 1, 6), 64); + add(new ItemStack(Blocks.wool, 1, 7), 64); + add(new ItemStack(Blocks.wool, 1, 8), 64); + add(new ItemStack(Blocks.wool, 1, 9), 64); + add(new ItemStack(Blocks.wool, 1, 10), 64); + add(new ItemStack(Blocks.wool, 1, 11), 64); + add(new ItemStack(Blocks.wool, 1, 12), 64); + add(new ItemStack(Blocks.wool, 1, 13), 64); + add(new ItemStack(Blocks.wool, 1, 14), 64); + add(new ItemStack(Blocks.wool, 1, 15), 64); add(Blocks.gold_block, 9 * 2048); add(Blocks.iron_block, 9 * 256); add(new ItemStack(Blocks.stone_slab, 1, 0), 0.5); @@ -98,22 +98,22 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Blocks.soul_sand, 49); add(Blocks.glowstone, 1536); add(Blocks.lit_pumpkin, 153); - add(new ItemStack(Blocks.stained_glass, 1, 0), 9); - add(new ItemStack(Blocks.stained_glass, 1, 1), 9); - add(new ItemStack(Blocks.stained_glass, 1, 2), 9); - add(new ItemStack(Blocks.stained_glass, 1, 3), 9); - add(new ItemStack(Blocks.stained_glass, 1, 4), 9); - add(new ItemStack(Blocks.stained_glass, 1, 5), 9); - add(new ItemStack(Blocks.stained_glass, 1, 6), 9); - add(new ItemStack(Blocks.stained_glass, 1, 7), 9); - add(new ItemStack(Blocks.stained_glass, 1, 8), 9); - add(new ItemStack(Blocks.stained_glass, 1, 9), 9); - add(new ItemStack(Blocks.stained_glass, 1, 10), 9); - add(new ItemStack(Blocks.stained_glass, 1, 11), 9); - add(new ItemStack(Blocks.stained_glass, 1, 12), 9); - add(new ItemStack(Blocks.stained_glass, 1, 13), 9); - add(new ItemStack(Blocks.stained_glass, 1, 14), 9); - add(new ItemStack(Blocks.stained_glass, 1, 15), 9); + add(new ItemStack(Blocks.stained_glass, 1, 0), 3); + add(new ItemStack(Blocks.stained_glass, 1, 1), 3); + add(new ItemStack(Blocks.stained_glass, 1, 2), 3); + add(new ItemStack(Blocks.stained_glass, 1, 3), 3); + add(new ItemStack(Blocks.stained_glass, 1, 4), 3); + add(new ItemStack(Blocks.stained_glass, 1, 5), 3); + add(new ItemStack(Blocks.stained_glass, 1, 6), 3); + add(new ItemStack(Blocks.stained_glass, 1, 7), 3); + add(new ItemStack(Blocks.stained_glass, 1, 8), 3); + add(new ItemStack(Blocks.stained_glass, 1, 9), 3); + add(new ItemStack(Blocks.stained_glass, 1, 10), 3); + add(new ItemStack(Blocks.stained_glass, 1, 11), 3); + add(new ItemStack(Blocks.stained_glass, 1, 12), 3); + add(new ItemStack(Blocks.stained_glass, 1, 13), 3); + add(new ItemStack(Blocks.stained_glass, 1, 14), 3); + add(new ItemStack(Blocks.stained_glass, 1, 15), 3); add(new ItemStack(Blocks.stonebrick, 1, 0), 1); add(new ItemStack(Blocks.stonebrick, 1, 1), 1); add(new ItemStack(Blocks.stonebrick, 1, 2), 1); @@ -144,22 +144,22 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(new ItemStack(Blocks.quartz_block, 1, 1), 1024); add(new ItemStack(Blocks.quartz_block, 1, 2), 1024); add(Blocks.quartz_stairs, 1536); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 0), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 1), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 2), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 3), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 4), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 5), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 6), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 7), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 8), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 9), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 10), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 11), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 12), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 13), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 14), 257); - add(new ItemStack(Blocks.stained_hardened_clay, 1, 15), 257); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 0), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 1), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 2), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 3), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 4), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 5), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 6), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 7), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 8), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 9), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 10), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 11), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 12), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 13), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 14), 258); + add(new ItemStack(Blocks.stained_hardened_clay, 1, 15), 258); add(new ItemStack(Blocks.log2, 1, 0), 32); add(new ItemStack(Blocks.log2, 1, 1), 32); add(Blocks.acacia_stairs, 12); @@ -222,52 +222,52 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Blocks.end_portal_frame, null); add(Blocks.ender_chest, 2304); add(new ItemStack(Blocks.anvil, 1, 0), 7936); - add(new ItemStack(Blocks.anvil, 1, 1), 5290.666); + add(new ItemStack(Blocks.anvil, 1, 1), 5290.667); add(new ItemStack(Blocks.anvil, 1, 2), 2645.333); add(Blocks.trapped_chest, 198); - add(new ItemStack(Blocks.stained_glass_pane, 1, 0), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 1), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 2), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 3), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 4), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 5), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 6), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 7), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 8), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 9), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 10), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 11), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 12), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 13), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 14), 3.375); - add(new ItemStack(Blocks.stained_glass_pane, 1, 15), 3.375); + add(new ItemStack(Blocks.stained_glass_pane, 1, 0), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 1), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 2), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 3), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 4), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 5), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 6), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 7), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 8), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 9), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 10), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 11), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 12), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 13), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 14), 1.125); + add(new ItemStack(Blocks.stained_glass_pane, 1, 15), 1.125); add(new ItemStack(Blocks.leaves2, 1, 0), 1); add(new ItemStack(Blocks.leaves2, 1, 1), 1); add(new ItemStack(Blocks.carpet, 1, 0), 32); - add(new ItemStack(Blocks.carpet, 1, 1), 37.333); - add(new ItemStack(Blocks.carpet, 1, 2), 37.333); - add(new ItemStack(Blocks.carpet, 1, 3), 37.333); - add(new ItemStack(Blocks.carpet, 1, 4), 37.333); - add(new ItemStack(Blocks.carpet, 1, 5), 37.333); - add(new ItemStack(Blocks.carpet, 1, 6), 37.333); - add(new ItemStack(Blocks.carpet, 1, 7), 37.333); - add(new ItemStack(Blocks.carpet, 1, 8), 37.333); - add(new ItemStack(Blocks.carpet, 1, 9), 37.333); - add(new ItemStack(Blocks.carpet, 1, 10), 37.333); - add(new ItemStack(Blocks.carpet, 1, 11), 37.333); - add(new ItemStack(Blocks.carpet, 1, 12), 37.333); - add(new ItemStack(Blocks.carpet, 1, 13), 37.333); - add(new ItemStack(Blocks.carpet, 1, 14), 37.333); - add(new ItemStack(Blocks.carpet, 1, 15), 37.333); - add(new ItemStack(Blocks.carpet, 1, 15), 37.333); - add(new ItemStack(Blocks.double_plant, 1, 0), 16); - add(new ItemStack(Blocks.double_plant, 1, 1), 16); - add(new ItemStack(Blocks.double_plant, 1, 2), 16); - add(new ItemStack(Blocks.double_plant, 1, 3), 16); - add(new ItemStack(Blocks.double_plant, 1, 4), 16); - add(new ItemStack(Blocks.double_plant, 1, 5), 16); + add(new ItemStack(Blocks.carpet, 1, 1), 42.667); + add(new ItemStack(Blocks.carpet, 1, 2), 42.667); + add(new ItemStack(Blocks.carpet, 1, 3), 42.667); + add(new ItemStack(Blocks.carpet, 1, 4), 42.667); + add(new ItemStack(Blocks.carpet, 1, 5), 42.667); + add(new ItemStack(Blocks.carpet, 1, 6), 42.667); + add(new ItemStack(Blocks.carpet, 1, 7), 42.667); + add(new ItemStack(Blocks.carpet, 1, 8), 42.667); + add(new ItemStack(Blocks.carpet, 1, 9), 42.667); + add(new ItemStack(Blocks.carpet, 1, 10), 42.667); + add(new ItemStack(Blocks.carpet, 1, 11), 42.667); + add(new ItemStack(Blocks.carpet, 1, 12), 42.667); + add(new ItemStack(Blocks.carpet, 1, 13), 42.667); + add(new ItemStack(Blocks.carpet, 1, 14), 42.667); + add(new ItemStack(Blocks.carpet, 1, 15), 42.667); + add(new ItemStack(Blocks.carpet, 1, 15), 42.667); + add(new ItemStack(Blocks.double_plant, 1, 0), 32); + add(new ItemStack(Blocks.double_plant, 1, 1), 32); + add(new ItemStack(Blocks.double_plant, 1, 2), 32); + add(new ItemStack(Blocks.double_plant, 1, 3), 32); + add(new ItemStack(Blocks.double_plant, 1, 4), 32); + add(new ItemStack(Blocks.double_plant, 1, 5), 32); add(Items.painting, 80); - add(Items.sign, 52); + add(Items.sign, 17.333); add(Items.flower_pot, 192); add(new ItemStack(Blocks.skull, 1, 0), null); add(new ItemStack(Blocks.skull, 1, 1), null); @@ -288,7 +288,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Blocks.wooden_pressure_plate, 16); add(Blocks.redstone_torch, 36); add(Blocks.stone_button, 1); - add(Blocks.trapdoor, 48); + add(Blocks.trapdoor, 24); add(Blocks.fence_gate, 32); add(Blocks.redstone_lamp, 1664); add(Blocks.tripwire_hook, 134); @@ -309,7 +309,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite private void addTransportationTabTestCases() { add(Blocks.golden_rail, 2054); - add(Blocks.detector_rail, 261.666); + add(Blocks.detector_rail, 261.667); add(Blocks.rail, 96.25); add(Blocks.activator_rail, 263.333); add(Items.minecart, 1280); @@ -333,7 +333,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Items.paper, 32); add(Items.book, 160); add(Items.slime_ball, 24); - add(Items.bone, 24); + add(Items.bone, 48); add(Items.ender_pearl, 1024); add(Items.ender_eye, 1792); add(new ItemStack(Items.spawn_egg, 1, 50), null); @@ -364,7 +364,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(new ItemStack(Items.spawn_egg, 1, 99), null); add(Items.experience_bottle, null); add(Items.fire_charge, 330.667); - add(Items.writable_book, 216); + add(Items.writable_book, 224); add(Items.map, 1312); add(Items.firework_charge, null); add(Items.iron_horse_armor, null); @@ -386,7 +386,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite private void addFoodstuffsTabTestCases() { add(Items.apple, 24); - add(Items.mushroom_stew, 68); + add(Items.mushroom_stew, 70); add(Items.bread, 72); add(Items.porkchop, 24); add(Items.cooked_porkchop, 24); @@ -399,7 +399,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(new ItemStack(Items.cooked_fished, 1, 0), 24); add(new ItemStack(Items.cooked_fished, 1, 1), 24); add(Items.cake, 360); - add(Items.cookie, 7); + add(Items.cookie, 8); add(Items.melon, 16); add(Items.beef, 24); add(Items.cooked_beef, 24); @@ -442,7 +442,7 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Items.fishing_rod, 36); add(Items.clock, 8224); add(Items.shears, 512); - add(Items.lead, 72); + add(Items.lead, 36); add(Items.name_tag, null); add(new ItemStack(Items.enchanted_book, 1, OreDictionary.WILDCARD_VALUE), null); } @@ -568,22 +568,22 @@ public class VanillaEnergyValueTest extends EnergyValueMappingsTestSuite add(Items.reeds, 32); add(Items.egg, 32); add(Items.glowstone_dust, 384); - add(new ItemStack(Items.dye, 1, 0), 8); - add(new ItemStack(Items.dye, 1, 1), 8); - add(new ItemStack(Items.dye, 1, 2), 8); - add(new ItemStack(Items.dye, 1, 3), 8); + add(new ItemStack(Items.dye, 1, 0), 16); + add(new ItemStack(Items.dye, 1, 1), 16); + add(new ItemStack(Items.dye, 1, 2), 16); + add(new ItemStack(Items.dye, 1, 3), 16); add(new ItemStack(Items.dye, 1, 4), 864); - add(new ItemStack(Items.dye, 1, 5), 8); - add(new ItemStack(Items.dye, 1, 6), 8); - add(new ItemStack(Items.dye, 1, 7), 8); - add(new ItemStack(Items.dye, 1, 8), 8); - add(new ItemStack(Items.dye, 1, 9), 8); - add(new ItemStack(Items.dye, 1, 10), 8); - add(new ItemStack(Items.dye, 1, 11), 8); - add(new ItemStack(Items.dye, 1, 12), 8); - add(new ItemStack(Items.dye, 1, 13), 8); - add(new ItemStack(Items.dye, 1, 14), 8); - add(new ItemStack(Items.dye, 1, 15), 8); + add(new ItemStack(Items.dye, 1, 5), 16); + add(new ItemStack(Items.dye, 1, 6), 16); + add(new ItemStack(Items.dye, 1, 7), 16); + add(new ItemStack(Items.dye, 1, 8), 16); + add(new ItemStack(Items.dye, 1, 9), 16); + add(new ItemStack(Items.dye, 1, 10), 16); + add(new ItemStack(Items.dye, 1, 11), 16); + add(new ItemStack(Items.dye, 1, 12), 16); + add(new ItemStack(Items.dye, 1, 13), 16); + add(new ItemStack(Items.dye, 1, 14), 16); + add(new ItemStack(Items.dye, 1, 15), 16); add(Items.sugar, 32); add(Items.pumpkin_seeds, 36); add(Items.melon_seeds, 16); diff --git a/src/main/java/com/pahimar/ee3/tileentity/TileEntityTransmutationTablet.java b/src/main/java/com/pahimar/ee3/tileentity/TileEntityTransmutationTablet.java index 0d659db8..0d536231 100644 --- a/src/main/java/com/pahimar/ee3/tileentity/TileEntityTransmutationTablet.java +++ b/src/main/java/com/pahimar/ee3/tileentity/TileEntityTransmutationTablet.java @@ -44,31 +44,32 @@ public class TileEntityTransmutationTablet extends TileEntityEE implements ISide { super(); rotation = ForgeDirection.UNKNOWN; + availableEnergyValue = new EnergyValue(0); storedEnergyValue = new EnergyValue(0); inventory = new ItemStack[INVENTORY_SIZE]; } + public EnergyValue getAvailableEnergyValue() + { + return availableEnergyValue; + } + public EnergyValue getStoredEnergyValue() { return storedEnergyValue; } - public void setStoredEnergyValue(EnergyValue storedEnergyValue) - { - this.storedEnergyValue = storedEnergyValue; - } - public void updateEnergyValueFromInventory() { - float newEnergyValue = 0f; + float newEnergyValue = storedEnergyValue.getValue(); for (int i = 0; i <= STONE_INDEX; i++) { if (inventory[i] != null && EnergyValueRegistry.getInstance().hasEnergyValue(inventory[i])) { - newEnergyValue += EnergyValueRegistry.getInstance().getEnergyValue(inventory[i]).getEnergyValue() * inventory[i].stackSize; + newEnergyValue += EnergyValueRegistry.getInstance().getEnergyValueForStack(inventory[i]).getValue(); } } - this.storedEnergyValue = new EnergyValue(newEnergyValue); + this.availableEnergyValue = new EnergyValue(newEnergyValue); } public ForgeDirection getRotation() diff --git a/src/main/java/com/pahimar/ee3/util/EnergyValueHelper.java b/src/main/java/com/pahimar/ee3/util/EnergyValueHelper.java index 3f7a457d..9ebb655f 100644 --- a/src/main/java/com/pahimar/ee3/util/EnergyValueHelper.java +++ b/src/main/java/com/pahimar/ee3/util/EnergyValueHelper.java @@ -31,7 +31,7 @@ public class EnergyValueHelper { if (itemStack.getItem().getContainerItem(itemStack) != null) { - stackSize = FluidContainerRegistry.getFluidForFilledItem(itemStack).amount; + stackSize = FluidContainerRegistry.getFluidForFilledItem(itemStack).amount * wrappedStack.getStackSize(); wrappedStackValue = EnergyValueRegistry.getInstance().getEnergyValueFromMap(stackValueMappings, FluidContainerRegistry.getFluidForFilledItem(itemStack)); } else @@ -45,8 +45,8 @@ public class EnergyValueHelper if (EnergyValueRegistry.getInstance().hasEnergyValue(itemStack) && EnergyValueRegistry.getInstance().hasEnergyValue(containerItemStack)) { - float itemStackValue = EnergyValueRegistry.getInstance().getEnergyValueFromMap(stackValueMappings, itemStack).getEnergyValue(); - float containerStackValue = EnergyValueRegistry.getInstance().getEnergyValueFromMap(stackValueMappings, containerItemStack).getEnergyValue(); + float itemStackValue = EnergyValueRegistry.getInstance().getEnergyValueFromMap(stackValueMappings, itemStack).getValue(); + float containerStackValue = EnergyValueRegistry.getInstance().getEnergyValueFromMap(stackValueMappings, containerItemStack).getValue(); wrappedStackValue = new EnergyValue(itemStackValue - containerStackValue); } else @@ -91,7 +91,7 @@ public class EnergyValueHelper stackSize = wrappedStack.getStackSize(); } - computedValue += wrappedStackValue.getEnergyValue() * stackSize; + computedValue += wrappedStackValue.getValue() * stackSize; } else { @@ -111,7 +111,7 @@ public class EnergyValueHelper { if ((Float.compare(factor, 0f) != 0) && (energyValue != null)) { - return new EnergyValue(new BigDecimal(energyValue.getEnergyValue() * 1f / factor).setScale(3, BigDecimal.ROUND_HALF_EVEN).floatValue()); + return new EnergyValue(new BigDecimal(energyValue.getValue() * 1f / factor).setScale(3, BigDecimal.ROUND_HALF_EVEN).floatValue()); } else { diff --git a/src/main/java/com/pahimar/ee3/util/FilterUtils.java b/src/main/java/com/pahimar/ee3/util/FilterUtils.java index cbd0b8eb..9fbcfe4b 100644 --- a/src/main/java/com/pahimar/ee3/util/FilterUtils.java +++ b/src/main/java/com/pahimar/ee3/util/FilterUtils.java @@ -108,12 +108,12 @@ public class FilterUtils public static Set filterByEnergyValue(Collection unfilteredCollection, EnergyValue energyValue) { - return filterByEnergyValue(unfilteredCollection, energyValue.getEnergyValue()); + return filterByEnergyValue(unfilteredCollection, energyValue.getValue()); } public static Set filterByEnergyValue(Collection unfilteredCollection, EnergyValue energyValue, Comparator comparator) { - return filterByEnergyValue(unfilteredCollection, energyValue.getEnergyValue(), comparator); + return filterByEnergyValue(unfilteredCollection, energyValue.getValue(), comparator); } public static Set filterByEnergyValue(Collection unfilteredCollection, float energyValue) @@ -124,7 +124,7 @@ public class FilterUtils { if (energyValue > 0f && EnergyValueRegistryProxy.hasEnergyValue(itemStack)) { - if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getEnergyValue() <= energyValue) + if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getValue() <= energyValue) { sortedSet.add(itemStack); } @@ -142,7 +142,7 @@ public class FilterUtils { if (energyValue > 0f && EnergyValueRegistryProxy.hasEnergyValue(itemStack)) { - if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getEnergyValue() <= energyValue) + if (EnergyValueRegistryProxy.getEnergyValue(itemStack).getValue() <= energyValue) { sortedSet.add(itemStack); } diff --git a/src/main/java/com/pahimar/ee3/util/FluidHelper.java b/src/main/java/com/pahimar/ee3/util/FluidHelper.java index 1ccd1b12..38a517f2 100644 --- a/src/main/java/com/pahimar/ee3/util/FluidHelper.java +++ b/src/main/java/com/pahimar/ee3/util/FluidHelper.java @@ -1,5 +1,6 @@ package com.pahimar.ee3.util; +import com.pahimar.ee3.reference.Names; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -11,8 +12,6 @@ import java.util.Comparator; public class FluidHelper { - - // TODO Possible problem with comparator public static Comparator comparator = new Comparator() { @@ -84,7 +83,7 @@ public class FluidHelper // Register Milk in the FluidRegistry if it hasn't already been done if (!FluidRegistry.isFluidRegistered("milk")) { - Fluid milk = new Fluid("milk").setUnlocalizedName(Items.milk_bucket.getUnlocalizedName()); + Fluid milk = new Fluid("milk").setUnlocalizedName(Names.Fluids.MILK); FluidRegistry.registerFluid(milk); FluidContainerRegistry.registerFluidContainer(new FluidStack(milk, 1000), new ItemStack(Items.milk_bucket), new ItemStack(Items.bucket)); } diff --git a/src/main/java/com/pahimar/ee3/util/ItemHelper.java b/src/main/java/com/pahimar/ee3/util/ItemHelper.java index 43be7f1d..3de0652c 100644 --- a/src/main/java/com/pahimar/ee3/util/ItemHelper.java +++ b/src/main/java/com/pahimar/ee3/util/ItemHelper.java @@ -129,7 +129,7 @@ public class ItemHelper { if (EnergyValueRegistry.getInstance().hasEnergyValue(itemStack1) && EnergyValueRegistry.getInstance().hasEnergyValue(itemStack2)) { - return Float.compare(EnergyValueRegistry.getInstance().getEnergyValue(itemStack1).getEnergyValue(), EnergyValueRegistry.getInstance().getEnergyValue(itemStack2).getEnergyValue()); + return Float.compare(EnergyValueRegistry.getInstance().getEnergyValue(itemStack1).getValue(), EnergyValueRegistry.getInstance().getEnergyValue(itemStack2).getValue()); } else { diff --git a/src/main/java/com/pahimar/ee3/util/RecipeHelper.java b/src/main/java/com/pahimar/ee3/util/RecipeHelper.java index 8d60d078..a28b46d6 100644 --- a/src/main/java/com/pahimar/ee3/util/RecipeHelper.java +++ b/src/main/java/com/pahimar/ee3/util/RecipeHelper.java @@ -49,7 +49,7 @@ public class RecipeHelper itemStack.stackSize = 1; } - recipeInputs.add(new WrappedStack(itemStack)); + recipeInputs.add(WrappedStack.wrap(itemStack)); } } } @@ -68,7 +68,7 @@ public class RecipeHelper itemStack.stackSize = 1; } - recipeInputs.add(new WrappedStack(itemStack)); + recipeInputs.add(WrappedStack.wrap(itemStack)); } } } @@ -76,7 +76,6 @@ public class RecipeHelper { ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; - // if (validateShapedOreDictionaryRecipe(shapedOreRecipe.getInput())) if (validateOreDictionaryRecipe(Arrays.asList(shapedOreRecipe.getInput()))) { for (int i = 0; i < shapedOreRecipe.getInput().length; i++) @@ -86,16 +85,15 @@ public class RecipeHelper */ if (shapedOreRecipe.getInput()[i] instanceof ArrayList) { - WrappedStack oreStack = new WrappedStack(shapedOreRecipe.getInput()[i]); + WrappedStack oreStack = WrappedStack.wrap(shapedOreRecipe.getInput()[i]); - if (oreStack.getWrappedObject() instanceof OreStack) + if (oreStack != null && oreStack.getWrappedObject() instanceof OreStack) { recipeInputs.add(oreStack); } } else if (shapedOreRecipe.getInput()[i] instanceof ItemStack) { - ItemStack itemStack = ((ItemStack) shapedOreRecipe.getInput()[i]).copy(); if (itemStack.stackSize > 1) @@ -103,7 +101,7 @@ public class RecipeHelper itemStack.stackSize = 1; } - recipeInputs.add(new WrappedStack(itemStack)); + recipeInputs.add(WrappedStack.wrap(itemStack)); } } } @@ -119,7 +117,7 @@ public class RecipeHelper if (object instanceof ArrayList) { - recipeInputs.add(new WrappedStack(object)); + recipeInputs.add(WrappedStack.wrap(object)); } else if (object instanceof ItemStack) { @@ -131,7 +129,7 @@ public class RecipeHelper itemStack.stackSize = 1; } - recipeInputs.add(new WrappedStack(itemStack)); + recipeInputs.add(WrappedStack.wrap(itemStack)); } } } @@ -159,8 +157,7 @@ public class RecipeHelper if (WrappedStack.canBeWrapped(object)) { - - stack = new WrappedStack(object); + stack = WrappedStack.wrap(object); if (collatedStacks.isEmpty()) { @@ -215,10 +212,9 @@ public class RecipeHelper { for (Object object : objects) { - if (object instanceof ArrayList) + if (object != null) { - ArrayList list = (ArrayList) object; - if (list.isEmpty()) + if (!WrappedStack.canBeWrapped(object)) { return false; } diff --git a/src/main/resources/assets/ee3/lang/en_US.lang b/src/main/resources/assets/ee3/lang/en_US.lang index bd389f63..e916c115 100644 --- a/src/main/resources/assets/ee3/lang/en_US.lang +++ b/src/main/resources/assets/ee3/lang/en_US.lang @@ -92,6 +92,9 @@ tile.ee3:alchemyArray.name=Alchemy Array tile.ee3:dummyArray.name=Alchemy Array tile.ee3:transmutationTablet.name=Transmutation Tablet +# Fluids +fluid.ee3.milk=Milk + # Alchemy Arrays arrays.ee3:basicAlchemyArray=Basic Alchemy Array [WIP] arrays.ee3:transmutation=Transmutation Alchemy Array [WIP]