diff --git a/common/crazypants/enderio/machine/AbstractPoweredTaskEntity.java b/common/crazypants/enderio/machine/AbstractPoweredTaskEntity.java index 63ffc3b6..4aea811e 100644 --- a/common/crazypants/enderio/machine/AbstractPoweredTaskEntity.java +++ b/common/crazypants/enderio/machine/AbstractPoweredTaskEntity.java @@ -84,7 +84,6 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im return requiresClientSync; } - float chance = random.nextFloat(); // Then see if we need to start a new one IMachineRecipe nextRecipe = canStartNextTask(chance); @@ -103,7 +102,6 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im powerHandler.setEnergy(powerHandler.getEnergyStored() - used); currentTask.update(used); - // then check if we are done if(currentTask.isComplete()) { taskComplete(); @@ -157,18 +155,20 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im } protected IMachineRecipe canStartNextTask(float chance) { - IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getInputs()); if(nextRecipe == null) { return null; // no template } - // make sure we have room for the next output + return canInsertResult(chance, nextRecipe) ? nextRecipe : null; + } + + protected boolean canInsertResult(float chance, IMachineRecipe nextRecipe) { // if we have an empty output, all good for (int i = slotDefinition.minOutputSlot; i <= slotDefinition.maxOutputSlot; i++) { if(inventory[i] == null) { - return nextRecipe; + return true; } } @@ -189,11 +189,11 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity im canMerge += getNumCanMerge(outStack, result); } if(canMerge < result.stackSize) { - return null; + return false; } } - return nextRecipe; + return true; } protected boolean hasInputStacks() { diff --git a/common/crazypants/enderio/machine/alloy/AlloyRecipeManager.java b/common/crazypants/enderio/machine/alloy/AlloyRecipeManager.java index 21480a97..1f09f89b 100644 --- a/common/crazypants/enderio/machine/alloy/AlloyRecipeManager.java +++ b/common/crazypants/enderio/machine/alloy/AlloyRecipeManager.java @@ -35,15 +35,15 @@ public class AlloyRecipeManager { private final List recipes = new ArrayList(); - private VanillaSmeltingRecipe vanillaRecipe = new VanillaSmeltingRecipe(); + VanillaSmeltingRecipe vanillaRecipe = new VanillaSmeltingRecipe(); public AlloyRecipeManager() { } public void loadRecipesFromConfig() { - + VanillaFurnaceTagHandler tagHandler = new VanillaFurnaceTagHandler(); - RecipeConfig config = RecipeConfig.loadRecipeConfig(CORE_FILE_NAME, CUSTOM_FILE_NAME, tagHandler); + RecipeConfig config = RecipeConfig.loadRecipeConfig(CORE_FILE_NAME, CUSTOM_FILE_NAME, tagHandler); if(config != null) { processConfig(config, tagHandler); } else { @@ -90,7 +90,7 @@ public class AlloyRecipeManager { for (Recipe rec : newRecipes) { addRecipe(new BasicAlloyRecipe(rec)); } - tagHandler.apply(); + tagHandler.apply(); Log.info("Finished processing Alloy Smelter recipes. " + recipes.size() + " recipes avaliable."); } diff --git a/common/crazypants/enderio/machine/alloy/TileAlloySmelter.java b/common/crazypants/enderio/machine/alloy/TileAlloySmelter.java index 09362cd0..a118f392 100644 --- a/common/crazypants/enderio/machine/alloy/TileAlloySmelter.java +++ b/common/crazypants/enderio/machine/alloy/TileAlloySmelter.java @@ -57,14 +57,24 @@ public class TileAlloySmelter extends AbstractPoweredTaskEntity { @Override protected IMachineRecipe canStartNextTask(float chance) { - IMachineRecipe result = super.canStartNextTask(chance); - if(mode == Mode.ALLOY && result instanceof VanillaSmeltingRecipe) { - result = null; + if(mode == Mode.FURNACE) { + VanillaSmeltingRecipe vr = AlloyRecipeManager.getInstance().vanillaRecipe; + if(vr.isRecipe(getInputs())) { + ItemStack[] res = vr.getCompletedResult(chance, getInputs()); + if(res == null || res.length == 0) { + return null; + } + return canInsertResult(chance, vr) ? vr : null; + } + return null; } - if(mode == Mode.FURNACE && !(result instanceof VanillaSmeltingRecipe)) { - result = null; + + IMachineRecipe nextRecipe = MachineRecipeRegistry.instance.getRecipeForInputs(getMachineName(), getInputs()); + if(nextRecipe == null) { + return null; // no template } - return result; + // make sure we have room for the next output + return canInsertResult(chance, nextRecipe) ? nextRecipe : null; } @Override diff --git a/common/crazypants/enderio/material/MaterialRecipes.java b/common/crazypants/enderio/material/MaterialRecipes.java index 5681abd9..bb71b10a 100644 --- a/common/crazypants/enderio/material/MaterialRecipes.java +++ b/common/crazypants/enderio/material/MaterialRecipes.java @@ -37,8 +37,12 @@ public class MaterialRecipes { OreDictionary.registerOre("glass", pureGlass); OreDictionary.registerOre("glassHardened", new ItemStack(ModObject.blockFusedQuartz.actualId, 1, BlockFusedQuartz.Type.FUSED_QUARTZ.ordinal())); - //Glass panes for compatability + //Glass stuff for compatability GameRegistry.addShapedRecipe(new ItemStack(Block.thinGlass), " ", "eee", "eee", 'e', pureGlass); + GameRegistry.addShapelessRecipe(new ItemStack(Block.glass), pureGlass); + GameRegistry.addShapedRecipe(new ItemStack(Item.glassBottle), " ", "g g", " g ", 'g', pureGlass); + + OreDictionary.registerOre("glass", Block.glass); /** * Register AE1's Silicon, remove after AE2 is out.