From ad4fb235354665478cd89dc3e99b28150c73f318 Mon Sep 17 00:00:00 2001 From: pahimar Date: Mon, 20 May 2013 00:19:26 -0400 Subject: [PATCH] Renamed the helper package to util, and work on better recipe inspection and result collation. --- .../com/pahimar/ee3/EquivalentExchange3.java | 8 +-- .../ee3/client/audio/SoundHandler.java | 2 +- .../gui/inventory/GuiAlchemicalBag.java | 2 +- .../gui/inventory/GuiPortableCrafting.java | 2 +- .../inventory/GuiPortableTransmutation.java | 2 +- .../pahimar/ee3/command/CommandOverlay.java | 2 +- .../pahimar/ee3/command/CommandParticles.java | 2 +- .../pahimar/ee3/command/CommandSounds.java | 2 +- .../pahimar/ee3/command/CommandVersion.java | 2 +- .../ee3/core/addons/AddonRedPower2.java | 4 +- .../ee3/core/handlers/CraftingHandler.java | 2 +- .../handlers/DrawBlockHighlightHandler.java | 2 +- .../core/handlers/EntityLivingHandler.java | 2 +- .../ee3/core/handlers/EquivalencyHandler.java | 4 +- .../ee3/core/handlers/ItemEventHandler.java | 2 +- .../ee3/core/handlers/KeyBindingHandler.java | 2 +- .../core/handlers/LocalizationHandler.java | 2 +- .../TransmutationTargetOverlayHandler.java | 2 +- .../handlers/VersionCheckTickHandler.java | 2 +- .../handlers/WorldTransmutationHandler.java | 2 +- .../pahimar/ee3/core/proxy/ClientProxy.java | 6 +- .../core/{helper => util}/GeneralHelper.java | 2 +- .../ee3/core/{helper => util}/ItemHelper.java | 47 +++++++++++- .../{helper => util}/KeyBindingHelper.java | 2 +- .../{helper => util}/LocalizationHelper.java | 2 +- .../ee3/core/{helper => util}/LogHelper.java | 2 +- .../ee3/core/{helper => util}/NBTHelper.java | 2 +- .../ee3/core/util/OreDictionaryStack.java | 71 +++++++++++++++++++ .../core/{helper => util}/QualityHelper.java | 2 +- .../core/{helper => util}/RecipeHelper.java | 64 ++++++++++------- .../{helper => util}/TransmutationHelper.java | 2 +- .../core/{helper => util}/VersionHelper.java | 2 +- .../ee3/inventory/ContainerAlchemicalBag.java | 2 +- .../inventory/ContainerPortableCrafting.java | 2 +- .../ContainerPortableTransmutation.java | 2 +- .../pahimar/ee3/item/ItemAlchemicalBag.java | 4 +- .../com/pahimar/ee3/item/ItemMiniumStone.java | 4 +- .../ee3/item/ItemPhilosophersStone.java | 4 +- .../ee3/recipe/RecipesTransmutationStone.java | 4 +- .../pahimar/ee3/tileentity/TileAludel.java | 2 +- .../pahimar/ee3/tileentity/TileGlassBell.java | 2 +- 41 files changed, 200 insertions(+), 80 deletions(-) rename ee3_common/com/pahimar/ee3/core/{helper => util}/GeneralHelper.java (97%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/ItemHelper.java (58%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/KeyBindingHelper.java (97%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/LocalizationHelper.java (97%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/LogHelper.java (94%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/NBTHelper.java (99%) create mode 100644 ee3_common/com/pahimar/ee3/core/util/OreDictionaryStack.java rename ee3_common/com/pahimar/ee3/core/{helper => util}/QualityHelper.java (96%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/RecipeHelper.java (78%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/TransmutationHelper.java (99%) rename ee3_common/com/pahimar/ee3/core/{helper => util}/VersionHelper.java (99%) diff --git a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java index 786ca2ff..d80b4731 100644 --- a/ee3_common/com/pahimar/ee3/EquivalentExchange3.java +++ b/ee3_common/com/pahimar/ee3/EquivalentExchange3.java @@ -20,16 +20,15 @@ import com.pahimar.ee3.core.handlers.LocalizationHandler; import com.pahimar.ee3.core.handlers.PlayerDestroyItemHandler; import com.pahimar.ee3.core.handlers.VersionCheckTickHandler; import com.pahimar.ee3.core.handlers.WorldTransmutationHandler; -import com.pahimar.ee3.core.helper.LogHelper; -import com.pahimar.ee3.core.helper.VersionHelper; import com.pahimar.ee3.core.proxy.CommonProxy; +import com.pahimar.ee3.core.util.LogHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.creativetab.CreativeTabEE3; import com.pahimar.ee3.item.ModItems; import com.pahimar.ee3.item.crafting.RecipesAlchemicalBagDyes; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.network.PacketHandler; -import com.pahimar.ee3.recipe.RecipesTransmutationStone; import cpw.mods.fml.common.Mod; import cpw.mods.fml.common.Mod.FingerprintWarning; @@ -150,9 +149,6 @@ public class EquivalentExchange3 { // Initialize custom rendering and pre-load textures (Client only) proxy.initRenderingAndTextures(); - // Load the Transmutation Stone recipes - RecipesTransmutationStone.init(); - // Add in the ability to dye Alchemical Bags CraftingManager.getInstance().getRecipeList().add(new RecipesAlchemicalBagDyes()); diff --git a/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java b/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java index c4a142a5..bd213070 100644 --- a/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java +++ b/ee3_common/com/pahimar/ee3/client/audio/SoundHandler.java @@ -5,7 +5,7 @@ import java.util.logging.Level; import net.minecraftforge.client.event.sound.SoundLoadEvent; import net.minecraftforge.event.ForgeSubscribe; -import com.pahimar.ee3.core.helper.LogHelper; +import com.pahimar.ee3.core.util.LogHelper; import com.pahimar.ee3.lib.Sounds; /** diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java index fbc6eb39..fda132e7 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiAlchemicalBag.java @@ -7,7 +7,7 @@ import net.minecraft.util.StatCollector; import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.inventory.ContainerAlchemicalBag; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java index 0098e85e..93682310 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableCrafting.java @@ -8,7 +8,7 @@ import net.minecraft.world.World; import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.inventory.ContainerPortableCrafting; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; diff --git a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java index e98c728b..c1301d40 100644 --- a/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java +++ b/ee3_common/com/pahimar/ee3/client/gui/inventory/GuiPortableTransmutation.java @@ -6,7 +6,7 @@ import net.minecraft.item.ItemStack; import org.lwjgl.opengl.GL11; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.lib.Textures; diff --git a/ee3_common/com/pahimar/ee3/command/CommandOverlay.java b/ee3_common/com/pahimar/ee3/command/CommandOverlay.java index 786d4fab..f51f49d6 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandOverlay.java +++ b/ee3_common/com/pahimar/ee3/command/CommandOverlay.java @@ -5,7 +5,7 @@ import net.minecraft.command.WrongUsageException; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; +import com.pahimar.ee3.core.util.LocalizationHelper; import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.Commands; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/command/CommandParticles.java b/ee3_common/com/pahimar/ee3/command/CommandParticles.java index ee6db178..9f43ff30 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandParticles.java +++ b/ee3_common/com/pahimar/ee3/command/CommandParticles.java @@ -5,7 +5,7 @@ import net.minecraft.command.WrongUsageException; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; +import com.pahimar.ee3.core.util.LocalizationHelper; import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.Commands; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/command/CommandSounds.java b/ee3_common/com/pahimar/ee3/command/CommandSounds.java index f4fd5799..b64d49f9 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandSounds.java +++ b/ee3_common/com/pahimar/ee3/command/CommandSounds.java @@ -5,7 +5,7 @@ import net.minecraft.command.WrongUsageException; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.LocalizationHelper; +import com.pahimar.ee3.core.util.LocalizationHelper; import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.Commands; diff --git a/ee3_common/com/pahimar/ee3/command/CommandVersion.java b/ee3_common/com/pahimar/ee3/command/CommandVersion.java index 8c9b8169..cc7e3dd6 100644 --- a/ee3_common/com/pahimar/ee3/command/CommandVersion.java +++ b/ee3_common/com/pahimar/ee3/command/CommandVersion.java @@ -3,7 +3,7 @@ package com.pahimar.ee3.command; import net.minecraft.command.ICommandSender; import net.minecraft.command.WrongUsageException; -import com.pahimar.ee3.core.helper.VersionHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.lib.Commands; /** diff --git a/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java b/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java index 2c7149e4..b55806da 100644 --- a/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java +++ b/ee3_common/com/pahimar/ee3/core/addons/AddonRedPower2.java @@ -5,8 +5,8 @@ import java.util.logging.Level; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.LogHelper; -import com.pahimar.ee3.core.helper.RecipeHelper; +import com.pahimar.ee3.core.util.LogHelper; +import com.pahimar.ee3.core.util.RecipeHelper; import com.pahimar.ee3.recipe.RecipesTransmutationStone; import cpw.mods.fml.common.Loader; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java index 52eae77b..2075f0b8 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/CraftingHandler.java @@ -5,7 +5,7 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; import cpw.mods.fml.common.ICraftingHandler; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java index 0bdfd9a6..02967037 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/DrawBlockHighlightHandler.java @@ -11,7 +11,7 @@ import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.lib.Textures; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java index 3e6989a9..dcecbc2a 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/EntityLivingHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.event.ForgeSubscribe; import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; -import com.pahimar.ee3.core.helper.ItemHelper; +import com.pahimar.ee3.core.util.ItemHelper; /** * Equivalent-Exchange-3 diff --git a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java index 1e6887ad..4233fb04 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/EquivalencyHandler.java @@ -5,8 +5,8 @@ import java.util.logging.Level; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.GeneralHelper; -import com.pahimar.ee3.core.helper.LogHelper; +import com.pahimar.ee3.core.util.GeneralHelper; +import com.pahimar.ee3.core.util.LogHelper; /** * Equivalent-Exchange-3 diff --git a/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java index ccf3bcb2..70d0f2c3 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/ItemEventHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.event.entity.item.ItemTossEvent; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; import net.minecraftforge.event.entity.player.PlayerDropsEvent; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; /** diff --git a/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java index 19b69a81..447cd793 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/KeyBindingHandler.java @@ -6,7 +6,7 @@ import net.minecraft.client.settings.KeyBinding; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.KeyBindingHelper; +import com.pahimar.ee3.core.util.KeyBindingHelper; import com.pahimar.ee3.item.IKeyBound; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.network.PacketTypeHandler; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java index edacd001..bdc1ca05 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/LocalizationHandler.java @@ -1,6 +1,6 @@ package com.pahimar.ee3.core.handlers; -import com.pahimar.ee3.core.helper.LocalizationHelper; +import com.pahimar.ee3.core.util.LocalizationHelper; import com.pahimar.ee3.lib.Localizations; import cpw.mods.fml.common.registry.LanguageRegistry; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java index 632a2b25..d4d340af 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/TransmutationTargetOverlayHandler.java @@ -14,7 +14,7 @@ import org.lwjgl.opengl.GL12; import com.pahimar.ee3.client.renderer.RenderUtils; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.ITransmutationStone; import com.pahimar.ee3.lib.Reference; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java index 08ccb6ac..98c4b597 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/VersionCheckTickHandler.java @@ -6,7 +6,7 @@ import net.minecraftforge.common.Configuration; import com.pahimar.ee3.configuration.ConfigurationHandler; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.VersionHelper; +import com.pahimar.ee3.core.util.VersionHelper; import com.pahimar.ee3.lib.Reference; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java b/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java index dfd8fe7a..24ae7635 100644 --- a/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java +++ b/ee3_common/com/pahimar/ee3/core/handlers/WorldTransmutationHandler.java @@ -9,7 +9,7 @@ import net.minecraftforge.event.Event.Result; import net.minecraftforge.event.ForgeSubscribe; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.event.ActionEvent; import com.pahimar.ee3.event.ActionEvent.ActionResult; import com.pahimar.ee3.event.ActionRequestEvent; diff --git a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java index 3324149e..00d5ad2c 100644 --- a/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java +++ b/ee3_common/com/pahimar/ee3/core/proxy/ClientProxy.java @@ -21,9 +21,9 @@ import com.pahimar.ee3.client.renderer.tileentity.TileEntityGlassBellRenderer; import com.pahimar.ee3.core.handlers.DrawBlockHighlightHandler; import com.pahimar.ee3.core.handlers.KeyBindingHandler; import com.pahimar.ee3.core.handlers.TransmutationTargetOverlayHandler; -import com.pahimar.ee3.core.helper.ItemHelper; -import com.pahimar.ee3.core.helper.KeyBindingHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.ItemHelper; +import com.pahimar.ee3.core.util.KeyBindingHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.item.IChargeable; import com.pahimar.ee3.lib.ActionTypes; import com.pahimar.ee3.lib.BlockIds; diff --git a/ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java b/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java similarity index 97% rename from ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java rename to ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java index 23edc26e..a194e5a2 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/GeneralHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/GeneralHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; diff --git a/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java b/ee3_common/com/pahimar/ee3/core/util/ItemHelper.java similarity index 58% rename from ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java rename to ee3_common/com/pahimar/ee3/core/util/ItemHelper.java index 17b5d931..25891de6 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/ItemHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/ItemHelper.java @@ -1,8 +1,10 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; + +import java.util.ArrayList; +import java.util.List; import net.minecraft.entity.EntityLiving; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -35,6 +37,47 @@ public class ItemHelper { return false; } + + public static ArrayList collateStacks(List unCollatedStacks) { + ArrayList collatedStacks = new ArrayList(); + + for (int i = 0; i < unCollatedStacks.size(); i++) { + + if (collatedStacks.size() == 0) { + collatedStacks.add(unCollatedStacks.get(i)); + } + else { + boolean found = false; + + for (int j = 0; j < collatedStacks.size(); j++) { + if ((unCollatedStacks.get(i) instanceof ItemStack) && (collatedStacks.get(j) instanceof ItemStack)) { + ItemStack unCollatedStack = (ItemStack) unCollatedStacks.get(i); + ItemStack collatedStack = (ItemStack) collatedStacks.get(j); + + if (compare(unCollatedStack, collatedStack)) { + ((ItemStack) collatedStacks.get(j)).stackSize += 1; + found = true; + } + } + else if ((unCollatedStacks.get(i) instanceof OreDictionaryStack) && (collatedStacks.get(j) instanceof OreDictionaryStack)) { + OreDictionaryStack unCollatedStack = (OreDictionaryStack) unCollatedStacks.get(i); + OreDictionaryStack collatedStack = (OreDictionaryStack) collatedStacks.get(j); + + if (OreDictionaryStack.compareStacks(unCollatedStack, collatedStack)) { + ((OreDictionaryStack) collatedStacks.get(j)).stackSize += 1; + found = true; + } + } + } + + if (!found) { + collatedStacks.add(unCollatedStacks.get(i)); + } + } + } + + return collatedStacks; + } public static boolean hasColor(ItemStack itemStack) { diff --git a/ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java b/ee3_common/com/pahimar/ee3/core/util/KeyBindingHelper.java similarity index 97% rename from ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java rename to ee3_common/com/pahimar/ee3/core/util/KeyBindingHelper.java index a1aad84f..75db9498 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/KeyBindingHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/KeyBindingHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; diff --git a/ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java b/ee3_common/com/pahimar/ee3/core/util/LocalizationHelper.java similarity index 97% rename from ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java rename to ee3_common/com/pahimar/ee3/core/util/LocalizationHelper.java index ec195981..a3422cf5 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/LocalizationHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/LocalizationHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import cpw.mods.fml.common.registry.LanguageRegistry; diff --git a/ee3_common/com/pahimar/ee3/core/helper/LogHelper.java b/ee3_common/com/pahimar/ee3/core/util/LogHelper.java similarity index 94% rename from ee3_common/com/pahimar/ee3/core/helper/LogHelper.java rename to ee3_common/com/pahimar/ee3/core/util/LogHelper.java index 1f230577..9ef06ab2 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/LogHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/LogHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.logging.Level; import java.util.logging.Logger; diff --git a/ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java b/ee3_common/com/pahimar/ee3/core/util/NBTHelper.java similarity index 99% rename from ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java rename to ee3_common/com/pahimar/ee3/core/util/NBTHelper.java index 82fd4de7..e2b1ac8d 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/NBTHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/NBTHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; diff --git a/ee3_common/com/pahimar/ee3/core/util/OreDictionaryStack.java b/ee3_common/com/pahimar/ee3/core/util/OreDictionaryStack.java new file mode 100644 index 00000000..3f1d3d11 --- /dev/null +++ b/ee3_common/com/pahimar/ee3/core/util/OreDictionaryStack.java @@ -0,0 +1,71 @@ +package com.pahimar.ee3.core.util; + +import java.util.ArrayList; +import java.util.Comparator; + +import net.minecraft.item.ItemStack; +import net.minecraftforge.oredict.OreDictionary; + +public class OreDictionaryStack implements Comparator { + + private String oreDictionaryName; + public int stackSize; + + public OreDictionaryStack() { + + stackSize = 0; + oreDictionaryName = null; + } + + public OreDictionaryStack(String oreDictionaryName) { + + this.oreDictionaryName = oreDictionaryName; + stackSize = 1; + } + + public OreDictionaryStack(int oreID) { + + this(OreDictionary.getOreName(oreID)); + } + + public OreDictionaryStack(ItemStack itemStack) { + + this(OreDictionary.getOreID(itemStack)); + } + + public ArrayList getOres() { + + return OreDictionary.getOres(oreDictionaryName); + } + + public int getOreID() { + + return OreDictionary.getOreID(oreDictionaryName); + } + + public String toString() { + return "" + stackSize + "xoreDictionary." + oreDictionaryName; + } + + @Override + public int compare(OreDictionaryStack oreStack1, OreDictionaryStack oreStack2) { + + if ((oreStack1 != null) && (oreStack2 != null)) { + if (oreStack1.oreDictionaryName.equals(oreStack2.oreDictionaryName)) { + return 0; + } + } + + return -1; + } + + public static boolean compareStacks(OreDictionaryStack oreStack1, OreDictionaryStack oreStack2) { + + return oreStack1.compareToStack(oreStack2); + } + + public boolean compareToStack(OreDictionaryStack oreStack) { + + return (compare(this, oreStack) == 0); + } +} diff --git a/ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java b/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java similarity index 96% rename from ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java rename to ee3_common/com/pahimar/ee3/core/util/QualityHelper.java index b8c9b859..72aab085 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/QualityHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/QualityHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import net.minecraft.item.ItemStack; diff --git a/ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java b/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java similarity index 78% rename from ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java rename to ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java index d8b864ad..da3ad73c 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/RecipeHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/RecipeHelper.java @@ -1,7 +1,6 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; -import java.util.List; import net.minecraft.block.Block; import net.minecraft.item.Item; @@ -11,6 +10,7 @@ import net.minecraft.item.crafting.FurnaceRecipes; 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 cpw.mods.fml.common.registry.GameRegistry; @@ -27,70 +27,80 @@ import cpw.mods.fml.common.registry.GameRegistry; public class RecipeHelper { /** - * Returns a list of ItemStacks that represent the itemstacks that make up the given IRecipe + * Returns a list of elements that constitute the input in a crafting recipe * - * @param recipe The IRecipe being examined - * @return List of ItemStacks that constitute the inputs of the recipe, null if unable to access the inputs of the given IRecipe + * @param recipe + * The IRecipe being examined + * @return + * List of elements that constitute the input of the given IRecipe. Could be an ItemStack or an Arraylist */ - public static ArrayList getRecipeInputs(IRecipe recipe) { - ArrayList recipeInputs = null; + public static ArrayList getRecipeInputs(IRecipe recipe) { if (recipe instanceof ShapedRecipes) { ShapedRecipes shapedRecipe = (ShapedRecipes) recipe; - recipeInputs = new ArrayList(); + ArrayList recipeInputs = new ArrayList(); for (int i = 0; i < shapedRecipe.recipeItems.length; i++) { if (shapedRecipe.recipeItems[i] != null) { - recipeInputs.add(shapedRecipe.recipeItems[i]); + ItemStack shapedRecipeStack = shapedRecipe.recipeItems[i]; + shapedRecipeStack.stackSize = 1; + + recipeInputs.add(shapedRecipeStack); } } - return recipeInputs; + return ItemHelper.collateStacks(recipeInputs); } else if (recipe instanceof ShapelessRecipes) { ShapelessRecipes shapelessRecipe = (ShapelessRecipes) recipe; - recipeInputs = new ArrayList(shapelessRecipe.recipeItems); - - return recipeInputs; + return ItemHelper.collateStacks(new ArrayList(shapelessRecipe.recipeItems)); } else if (recipe instanceof ShapedOreRecipe) { ShapedOreRecipe shapedOreRecipe = (ShapedOreRecipe) recipe; - recipeInputs = new ArrayList(); + ArrayList recipeInputs = new ArrayList(); for (int i = 0; i < shapedOreRecipe.getInput().length; i++) { if (shapedOreRecipe.getInput()[i] instanceof ArrayList) { - ArrayList shapedOreRecipeInputs = (ArrayList) shapedOreRecipe.getInput()[i]; + ArrayList shapedOreRecipeList = (ArrayList) shapedOreRecipe.getInput()[i]; - for (ItemStack itemStack : shapedOreRecipeInputs) { - recipeInputs.add(itemStack); + if (shapedOreRecipeList.size() > 0) { + recipeInputs.add(new OreDictionaryStack((ItemStack)shapedOreRecipeList.get(0))); + } + } + else { + if (shapedOreRecipe.getInput()[i] != null) { + recipeInputs.add(shapedOreRecipe.getInput()[i]); } } } - return recipeInputs; + return ItemHelper.collateStacks(recipeInputs); } - // TODO: Ore Dict recipes should populate some sort of equivalency portion of the dynEMC system - // TODO: Recipe Inputs should populate into separate lists, so that the emc of the lists can be determined and minimized else if (recipe instanceof ShapelessOreRecipe) { ShapelessOreRecipe shapelessOreRecipe = (ShapelessOreRecipe) recipe; - recipeInputs = new ArrayList(); + ArrayList recipeInputs = new ArrayList(); - for (Object recipeInput : shapelessOreRecipe.getInput()) { - if (recipeInput instanceof ArrayList) { - ArrayList shapelessOreRecipeInputs = (ArrayList) recipeInput; + for (Object o : shapelessOreRecipe.getInput()) { + if (o instanceof ArrayList) { + ArrayList shapelessOreRecipeList = (ArrayList) o; - for (ItemStack itemStack : shapelessOreRecipeInputs) { - recipeInputs.add(itemStack); + if (shapelessOreRecipeList.size() > 0) { + recipeInputs.add(new OreDictionaryStack((ItemStack) shapelessOreRecipeList.get(0))); + } + } + else { + if (o != null) { + recipeInputs.add(o); } } } - return ((ShapelessOreRecipe) recipe).getInput(); + return ItemHelper.collateStacks(recipeInputs); } return null; diff --git a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java b/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java similarity index 99% rename from ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java rename to ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java index 995cd44c..15b91a85 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/TransmutationHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/TransmutationHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.util.ArrayList; diff --git a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java b/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java similarity index 99% rename from ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java rename to ee3_common/com/pahimar/ee3/core/util/VersionHelper.java index 1cb4493c..c9769c1d 100644 --- a/ee3_common/com/pahimar/ee3/core/helper/VersionHelper.java +++ b/ee3_common/com/pahimar/ee3/core/util/VersionHelper.java @@ -1,4 +1,4 @@ -package com.pahimar.ee3.core.helper; +package com.pahimar.ee3.core.util; import java.io.InputStream; import java.net.URL; diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java index 353ad889..eebc1887 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerAlchemicalBag.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; /** diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java index 3677a6e9..91eda2a1 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableCrafting.java @@ -6,7 +6,7 @@ import net.minecraft.inventory.ContainerWorkbench; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; /** diff --git a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java index cb060f5d..9fe70fce 100644 --- a/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java +++ b/ee3_common/com/pahimar/ee3/inventory/ContainerPortableTransmutation.java @@ -5,7 +5,7 @@ import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; import net.minecraft.item.ItemStack; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Strings; /** diff --git a/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java b/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java index 117e8cc1..27deb689 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java +++ b/ee3_common/com/pahimar/ee3/item/ItemAlchemicalBag.java @@ -8,8 +8,8 @@ import net.minecraft.util.Icon; import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; -import com.pahimar.ee3.core.helper.ItemHelper; -import com.pahimar.ee3.core.helper.NBTHelper; +import com.pahimar.ee3.core.util.ItemHelper; +import com.pahimar.ee3.core.util.NBTHelper; import com.pahimar.ee3.lib.Colours; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Reference; diff --git a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java index 86481f41..7ddfaf26 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemMiniumStone.java @@ -7,8 +7,8 @@ import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.NBTHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java b/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java index a9a6126f..bbb5945b 100644 --- a/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java +++ b/ee3_common/com/pahimar/ee3/item/ItemPhilosophersStone.java @@ -7,8 +7,8 @@ import net.minecraft.world.World; import com.pahimar.ee3.EquivalentExchange3; import com.pahimar.ee3.configuration.ConfigurationSettings; -import com.pahimar.ee3.core.helper.NBTHelper; -import com.pahimar.ee3.core.helper.TransmutationHelper; +import com.pahimar.ee3.core.util.NBTHelper; +import com.pahimar.ee3.core.util.TransmutationHelper; import com.pahimar.ee3.lib.GuiIds; import com.pahimar.ee3.lib.Sounds; import com.pahimar.ee3.lib.Strings; diff --git a/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java b/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java index ece9ef2f..9dd017dc 100644 --- a/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java +++ b/ee3_common/com/pahimar/ee3/recipe/RecipesTransmutationStone.java @@ -13,8 +13,8 @@ import net.minecraft.item.crafting.FurnaceRecipes; import net.minecraftforge.oredict.OreDictionary; import com.pahimar.ee3.core.handlers.EquivalencyHandler; -import com.pahimar.ee3.core.helper.GeneralHelper; -import com.pahimar.ee3.core.helper.RecipeHelper; +import com.pahimar.ee3.core.util.GeneralHelper; +import com.pahimar.ee3.core.util.RecipeHelper; import com.pahimar.ee3.item.ModItems; import com.pahimar.ee3.lib.Reference; diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java b/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java index e5c2f93c..649e2c49 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileAludel.java @@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.packet.Packet; -import com.pahimar.ee3.core.helper.ItemHelper; +import com.pahimar.ee3.core.util.ItemHelper; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate; diff --git a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java index 915785bf..704e2e89 100644 --- a/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java +++ b/ee3_common/com/pahimar/ee3/tileentity/TileGlassBell.java @@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.network.packet.Packet; -import com.pahimar.ee3.core.helper.ItemHelper; +import com.pahimar.ee3.core.util.ItemHelper; import com.pahimar.ee3.lib.Strings; import com.pahimar.ee3.network.PacketTypeHandler; import com.pahimar.ee3.network.packet.PacketTileWithItemUpdate;