diff --git a/build.xml b/build.xml
index 817c9f0c..3f818949 100644
--- a/build.xml
+++ b/build.xml
@@ -125,11 +125,11 @@
-
+
-
+
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 542b66b7..7e0eeb4d 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);
+
}
}
}
diff --git a/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java b/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java
index fdd88ad0..fac3077b 100644
--- a/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java
+++ b/common/crazypants/enderio/machine/generator/TileEntityStirlingGenerator.java
@@ -5,7 +5,6 @@ import java.util.List;
import java.util.ListIterator;
import net.minecraft.inventory.ISidedInventory;
-import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
@@ -133,8 +132,9 @@ 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) {
+ inventory[0] = containedItem;
} else {
decrStackSize(0, 1);
}
@@ -170,11 +170,11 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
while (receptorIterator.hasNext() && canTransmit > 0 && appliedCount < numReceptors) {
Receptor receptor = receptorIterator.next();
PowerInterface pp = receptor.receptor;
- if (pp != null && pp.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
+ if(pp != null && pp.getMinEnergyReceived(receptor.fromDir.getOpposite()) <= canTransmit) {
float used = pp.recieveEnergy(receptor.fromDir.getOpposite(), canTransmit);
transmitted += used;
canTransmit -= used;
- }
+ }
if(canTransmit <= 0) {
break;
}
@@ -204,7 +204,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
PowerInterface pi = PowerInterface.create(te);
if(pi != null) {
receptors.add(new Receptor(pi, dir));
- }
+ }
}
receptorIterator = receptors.listIterator();
receptorsDirty = false;
@@ -215,7 +215,7 @@ public class TileEntityStirlingGenerator extends AbstractMachineEntity implement
PowerInterface receptor;
ForgeDirection fromDir;
- private Receptor(PowerInterface rec, ForgeDirection fromDir) {
+ private Receptor(PowerInterface rec, ForgeDirection fromDir) {
this.receptor = rec;
this.fromDir = fromDir;
}
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();
}
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 @@