From b5fa0dda6e48f5c22efd37f715a434da154f3c41 Mon Sep 17 00:00:00 2001 From: TehSomeLuigi Date: Mon, 30 Sep 2013 20:46:20 +0100 Subject: [PATCH 1/5] Update build.xml to reobfuscate with Searge names Reobfuscating with Searge names (as opposed to the Obfuscated Minecraft classnames) will give the mod a pretty great chance of running on 1.6.4 even if compiled for 1.6.2, or any of the 1.6.x versions. --- build.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.xml b/build.xml index 670e6b63..40679e72 100644 --- a/build.xml +++ b/build.xml @@ -124,11 +124,11 @@ - + - + From 569c31c67c83140a1dc9b545192ec33208907d12 Mon Sep 17 00:00:00 2001 From: WayofTime Date: Sun, 3 Nov 2013 19:20:12 -0500 Subject: [PATCH 2/5] Updated the StirlingGenerator to accept custom contained item stacks. --- .../machine/generator/TileEntityStirlingGenerator.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java b/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java index c64f3173..a92b65df 100644 --- a/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java +++ b/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java @@ -136,8 +136,11 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement burnTime = TileEntityFurnace.getItemBurnTime(inventory[0]); if(burnTime > 0) { totalBurnTime = burnTime; - if(inventory[0].itemID == Item.bucketLava.itemID) { - inventory[0] = new ItemStack(Item.bucketEmpty); + ItemStack containedItem = inventory[0].getItem().getContainerItemStack(inventory[0]); + if(containedItem!=null){ + //if(inventory[0].itemID == Item.bucketLava.itemID) { + //inventory[0] = new ItemStack(Item.bucketEmpty); + inventory[0] = containedItem; } else { decrStackSize(0, 1); } From 198f6c64247ad8a91b42a048a593e804ef18e656 Mon Sep 17 00:00:00 2001 From: mistaqur Date: Mon, 11 Nov 2013 13:43:08 +0400 Subject: [PATCH 3/5] Registred NEI usage recipe handlers --- .../nei/AlloySmelterRecipeHandler.java | 69 +++++++++++++------ .../enderio/nei/NEIEnderIOConfig.java | 4 +- .../enderio/nei/SagMillRecipeHandler.java | 55 +++++++++++++-- 3 files changed, 102 insertions(+), 26 deletions(-) diff --git a/common/crazypants/enderio/nei/AlloySmelterRecipeHandler.java b/common/crazypants/enderio/nei/AlloySmelterRecipeHandler.java index 0e5577aa..825268a5 100644 --- a/common/crazypants/enderio/nei/AlloySmelterRecipeHandler.java +++ b/common/crazypants/enderio/nei/AlloySmelterRecipeHandler.java @@ -3,6 +3,7 @@ package crazypants.enderio.nei; import static codechicken.core.gui.GuiDraw.changeTexture; import static codechicken.core.gui.GuiDraw.drawTexturedModalRect; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.List; @@ -49,7 +50,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { //Set this up later to show all alloy recipes - //transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77, 7, 22, 12), "EnderIOAlloySmelter", new Object[0])); + transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77-5, 26-3, 19, 25), "EnderIOAlloySmelter", new Object[0])); } @Override @@ -58,18 +59,46 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { List recipes = RecipeReigistry.instance.getRecipesForOutput(IEnderIoRecipe.ALLOY_SMELTER_ID, result); for (IEnderIoRecipe recipe : recipes) { - List ri = recipe.getInputs(); - ItemStack[] ingredients = new ItemStack[ri.size()]; - for (int i = 0; i < ingredients.length; i++) { - ingredients[i] = ri.get(i).getItem(); - } for (IRecipeOutput output : recipe.getOutputs()) { - AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), ingredients, output.getItem()); + AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem()); arecipes.add(res); } } } + @Override + public void loadCraftingRecipes(String outputId, Object... results) + { + if(outputId.equals("EnderIOAlloySmelter") && getClass() == AlloySmelterRecipeHandler.class) + { + List recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.ALLOY_SMELTER_ID); + for (IEnderIoRecipe recipe : recipes) { + for (IRecipeOutput output : recipe.getOutputs()) { + AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem()); + arecipes.add(res); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + + List recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.ALLOY_SMELTER_ID); + + for (IEnderIoRecipe recipe : recipes) { + if (recipe.isInput(ingredient)) { + for (IRecipeOutput output : recipe.getOutputs()) { + AlloySmelterRecipe res = new AlloySmelterRecipe(recipe.getRequiredEnergy(), recipe.getInputs(), output.getItem()); + res.setIngredientPermutation(res.input, ingredient); + arecipes.add(res); + } + } + } + } + //Move the GUI down 8 pixels. @Override public void drawBackground(int recipe) { @@ -87,6 +116,13 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { GuiDraw.drawString(energyString, 100, 57, 0xFFFFFFFF); } + public List getInputs(IRecipeInput input) { + List result = new ArrayList(); + result.add(input.getItem()); + result.addAll(input.getEquivelentInputs()); + return result; + } + public class AlloySmelterRecipe extends TemplateRecipeHandler.CachedRecipe { private ArrayList input; @@ -100,7 +136,7 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { @Override public List getIngredients() { - return input; + return getCycledIngredients(cycleticks / 20, input); } @Override @@ -108,27 +144,20 @@ public class AlloySmelterRecipeHandler extends TemplateRecipeHandler { return output; } - public AlloySmelterRecipe(float energy, ItemStack ingredients[], ItemStack result) { - int recipeSize = ingredients.length; + public AlloySmelterRecipe(float energy, List ingredients, ItemStack result) { + int recipeSize = ingredients.size(); this.input = new ArrayList(); if(recipeSize > 0) { - this.input.add(new PositionedStack(ingredients[0], 49, 14)); + this.input.add(new PositionedStack(getInputs(ingredients.get(0)), 49, 14)); } if(recipeSize > 1) { - this.input.add(new PositionedStack(ingredients[1], 73, 4)); + this.input.add(new PositionedStack(getInputs(ingredients.get(1)), 73, 4)); } if(recipeSize > 2) { - this.input.add(new PositionedStack(ingredients[2], 98, 14)); + this.input.add(new PositionedStack(getInputs(ingredients.get(2)), 98, 14)); } this.output = new PositionedStack(result, 74, 54); this.energy = energy; //If we wanted to do an energy cost } - - public AlloySmelterRecipe(float energy, ItemStack ingredient, ItemStack result) { - this.input = new ArrayList(); - this.input.add(new PositionedStack(ingredient, 49, 14)); - this.output = new PositionedStack(result, 74, 54); - this.energy = energy; - } } } diff --git a/common/crazypants/enderio/nei/NEIEnderIOConfig.java b/common/crazypants/enderio/nei/NEIEnderIOConfig.java index f81d3831..819b7c6c 100644 --- a/common/crazypants/enderio/nei/NEIEnderIOConfig.java +++ b/common/crazypants/enderio/nei/NEIEnderIOConfig.java @@ -12,7 +12,9 @@ public class NEIEnderIOConfig implements IConfigureNEI { public void loadConfig() { API.registerRecipeHandler(new AlloySmelterRecipeHandler()); API.registerRecipeHandler(new SagMillRecipeHandler()); - API.setGuiOffset(GuiAlloySmelter.class, 50, 50); + API.registerUsageHandler(new AlloySmelterRecipeHandler()); + API.registerUsageHandler(new SagMillRecipeHandler()); + API.setGuiOffset(GuiAlloySmelter.class, 5, 3); API.hideItem(EnderIO.blockConduitFacade.blockID); if(!Config.photovoltaicCellEnabled) { API.hideItem(EnderIO.blockSolarPanel.blockID); diff --git a/common/crazypants/enderio/nei/SagMillRecipeHandler.java b/common/crazypants/enderio/nei/SagMillRecipeHandler.java index 930741f7..3bb2a8a6 100644 --- a/common/crazypants/enderio/nei/SagMillRecipeHandler.java +++ b/common/crazypants/enderio/nei/SagMillRecipeHandler.java @@ -1,6 +1,7 @@ package crazypants.enderio.nei; import java.awt.Point; +import java.awt.Rectangle; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -18,6 +19,7 @@ import codechicken.nei.PositionedStack; import codechicken.nei.recipe.GuiRecipe; import codechicken.nei.recipe.TemplateRecipeHandler; import crazypants.enderio.crafting.IEnderIoRecipe; +import crazypants.enderio.crafting.IRecipeInput; import crazypants.enderio.crafting.IRecipeOutput; import crazypants.enderio.crafting.RecipeReigistry; import crazypants.enderio.machine.crusher.GuiCrusher; @@ -54,7 +56,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { @Override public void loadTransferRects() { //Set this up later to show all alloy recipes - //transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(77, 7, 22, 12), "EnderIOAlloySmelter", new Object[0])); + transferRects.add(new TemplateRecipeHandler.RecipeTransferRect(new Rectangle(81-5, 32-11, 15, 23), "EnderIOSagMill", new Object[0])); } @Override @@ -66,7 +68,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { for (IEnderIoRecipe recipe : recipes) { List ro = recipe.getOutputs(); - MillRecipe res = new MillRecipe(result, recipe.getRequiredEnergy(), recipe.getInputs().get(0).getItem(), ro); + MillRecipe res = new MillRecipe(result, recipe.getRequiredEnergy(), recipe.getInputs().get(0), ro); toAdd.add(res); } @@ -75,6 +77,37 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { arecipes.addAll(toAdd); } + @Override + public void loadCraftingRecipes(String outputId, Object... results) + { + if(outputId.equals("EnderIOSagMill") && getClass() == SagMillRecipeHandler.class) + { + List recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.SAG_MILL_ID); + + for (IEnderIoRecipe recipe : recipes) { + for (IRecipeOutput output : recipe.getOutputs()) { + MillRecipe res = new MillRecipe(recipe.getRequiredEnergy(), recipe.getInputs().get(0), recipe.getOutputs()); + arecipes.add(res); + } + } + } else { + super.loadCraftingRecipes(outputId, results); + } + } + + @Override + public void loadUsageRecipes(ItemStack ingredient) { + + List recipes = RecipeReigistry.instance.getRecipesForCrafter(IEnderIoRecipe.SAG_MILL_ID); + + for (IEnderIoRecipe recipe : recipes) { + if (recipe.isInput(ingredient)) { + MillRecipe res = new MillRecipe(recipe.getRequiredEnergy(), recipe.getInputs().get(0), recipe.getOutputs()); + arecipes.add(res); + } + } + } + @Override public void drawExtras(int recipeIndex) { drawProgressBar(98, 33, 176, 0, 22, 13, 48, 3); @@ -125,6 +158,13 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { super.drawProgressBar(87 - 13, 37 - 16, 200, 0, 17, 24, completion, 1); } + public List getInputs(IRecipeInput input) { + List result = new ArrayList(); + result.add(input.getItem()); + result.addAll(input.getEquivelentInputs()); + return result; + } + private static Point offset = new Point(5, 11); public class MillRecipe extends TemplateRecipeHandler.CachedRecipe { @@ -156,6 +196,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { @Override public PositionedStack getIngredient() { + randomRenderPermutation(input, cycleticks / 20); return input; } @@ -169,9 +210,13 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { return otherOutputs; } - public MillRecipe(ItemStack targetedResult, float energy, ItemStack ingredient, List outputs) { + public MillRecipe(float energy, IRecipeInput ingredient, List outputs) { + this(null, energy, ingredient, outputs); + } + + public MillRecipe(ItemStack targetedResult, float energy, IRecipeInput ingredient, List outputs) { this.energy = energy; - input = new PositionedStack(ingredient, 80 - offset.x, 12 - offset.y); + input = new PositionedStack(getInputs(ingredient), 80 - offset.x, 12 - offset.y); output = new PositionedStack(outputs.get(0).getItem(), 49 - offset.x, 59 - offset.y); otherOutputs = new ArrayList(); if(outputs.size() > 1) { @@ -189,7 +234,7 @@ public class SagMillRecipeHandler extends TemplateRecipeHandler { numTargetOuput = 1; for (int i = 0; i < outputChance.length; i++) { outputChance[i] = outputs.get(i).getChance(); - if(outputs.get(i).isEquivalent(targetedResult)) { + if(targetedResult != null && outputs.get(i).isEquivalent(targetedResult)) { indexOfTargetOutput = i; numTargetOuput = outputs.get(i).getQuantity(); } From 4d1baecdb4fb53047484cc15a18a4459197cec70 Mon Sep 17 00:00:00 2001 From: Unrepentant-Atheist Date: Sat, 2 Nov 2013 02:29:09 +0100 Subject: [PATCH 4/5] Update SAGMillRecipes_Core.xml dustClay doesn't work for some people, it seems to be mod-dependent. Reverting back to vanilla itemID for clay-balls. --- resources/assets/enderio/config/SAGMillRecipes_Core.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/resources/assets/enderio/config/SAGMillRecipes_Core.xml b/resources/assets/enderio/config/SAGMillRecipes_Core.xml index e155424c..d87803c2 100644 --- a/resources/assets/enderio/config/SAGMillRecipes_Core.xml +++ b/resources/assets/enderio/config/SAGMillRecipes_Core.xml @@ -317,7 +317,7 @@ - + From ba5bffdf933234a5bff8625db2ccdbf916916bde Mon Sep 17 00:00:00 2001 From: CrazyPants Date: Tue, 19 Nov 2013 03:01:39 +0800 Subject: [PATCH 5/5] #196 Bug with adjacent liquid conduits #293 --- common/crazypants/enderio/conduit/ConduitUtil.java | 10 ++++++---- .../crazypants/enderio/conduit/RaytraceResult.java | 14 +++++++------- .../enderio/conduit/liquid/LiquidConduit.java | 7 +++++++ 3 files changed, 20 insertions(+), 11 deletions(-) diff --git a/common/crazypants/enderio/conduit/ConduitUtil.java b/common/crazypants/enderio/conduit/ConduitUtil.java index 97b374e4..713623f9 100644 --- a/common/crazypants/enderio/conduit/ConduitUtil.java +++ b/common/crazypants/enderio/conduit/ConduitUtil.java @@ -76,10 +76,12 @@ public class ConduitUtil { if(network == null) { return false; } - con.setNetwork(network); - network.addConduit(con); - network.notifyNetworkOfUpdate(); - return true; + if(con.setNetwork(network)) { + network.addConduit(con); + network.notifyNetworkOfUpdate(); + return true; + } + return false; } @SideOnly(Side.CLIENT) diff --git a/common/crazypants/enderio/conduit/RaytraceResult.java b/common/crazypants/enderio/conduit/RaytraceResult.java index 1f0a2758..d13039d9 100644 --- a/common/crazypants/enderio/conduit/RaytraceResult.java +++ b/common/crazypants/enderio/conduit/RaytraceResult.java @@ -30,14 +30,14 @@ public class RaytraceResult { public static void sort(final Vec3 origin, List toSort) { if(origin == null || toSort == null) { - Collections.sort(toSort, new Comparator() { - - @Override - public int compare(RaytraceResult o1, RaytraceResult o2) { - return Double.compare(o1.getDistanceTo(origin), o1.getDistanceTo(origin)); - } - }); + return; } + Collections.sort(toSort, new Comparator() { + @Override + public int compare(RaytraceResult o1, RaytraceResult o2) { + return Double.compare(o1.getDistanceTo(origin), o2.getDistanceTo(origin)); + } + }); } public final CollidableComponent component; diff --git a/common/crazypants/enderio/conduit/liquid/LiquidConduit.java b/common/crazypants/enderio/conduit/liquid/LiquidConduit.java index ab0313b3..e13ddf17 100644 --- a/common/crazypants/enderio/conduit/liquid/LiquidConduit.java +++ b/common/crazypants/enderio/conduit/liquid/LiquidConduit.java @@ -126,6 +126,13 @@ public class LiquidConduit extends AbstractConduit implements ILiquidConduit { if(neighbour != null) { neighbour.conduitConnectionRemoved(connDir.getOpposite()); } + FluidStack curFluidType = null; + if(network != null) { + curFluidType = network.getFluidType(); + } + network.destroyNetwork(); + setFluidType(curFluidType); + } } }