diff --git a/src/main/java/forestry/factory/gui/ContainerBottler.java b/src/main/java/forestry/factory/gui/ContainerBottler.java index 965177a1c..9e20645ca 100755 --- a/src/main/java/forestry/factory/gui/ContainerBottler.java +++ b/src/main/java/forestry/factory/gui/ContainerBottler.java @@ -25,10 +25,10 @@ public class ContainerBottler extends ContainerLiquidTanks { super(tile, player, 8, 84); this.addSlotToContainer(new SlotLiquidIn(tile, InventoryBottler.SLOT_INPUT_FULL_CONTAINER, 18, 7)); - this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_LEFT_PROCESSING, 18, 35).setPickupWatcher(tile)); + this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_EMPTYING_PROCESSING, 18, 35).setPickupWatcher(tile)); this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_OUTPUT_EMPTY_CONTAINER, 18, 63)); this.addSlotToContainer(new SlotEmptyLiquidContainerIn(tile, InventoryBottler.SLOT_INPUT_EMPTY_CONTAINER, 142, 7)); - this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_RIGHT_PROCESSING, 142, 35).setPickupWatcher(tile)); + this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_FILLING_PROCESSING, 142, 35).setPickupWatcher(tile)); this.addSlotToContainer(new SlotOutput(tile, InventoryBottler.SLOT_OUTPUT_FULL_CONTAINER, 142, 63)); } } diff --git a/src/main/java/forestry/factory/inventory/InventoryBottler.java b/src/main/java/forestry/factory/inventory/InventoryBottler.java index 240f4f1c1..47cb119d7 100644 --- a/src/main/java/forestry/factory/inventory/InventoryBottler.java +++ b/src/main/java/forestry/factory/inventory/InventoryBottler.java @@ -24,8 +24,8 @@ import forestry.factory.tiles.TileBottler; public class InventoryBottler extends InventoryAdapterTile { public static final short SLOT_INPUT_FULL_CONTAINER = 0; public static final short SLOT_INPUT_EMPTY_CONTAINER = 1; - public static final short SLOT_LEFT_PROCESSING = 2; - public static final short SLOT_RIGHT_PROCESSING = 3; + public static final short SLOT_EMPTYING_PROCESSING = 2; + public static final short SLOT_FILLING_PROCESSING = 3; public static final short SLOT_OUTPUT_EMPTY_CONTAINER = 4; public static final short SLOT_OUTPUT_FULL_CONTAINER = 5; diff --git a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeCategory.java b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeCategory.java index 5da38ab7a..d27c60601 100644 --- a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeCategory.java +++ b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeCategory.java @@ -59,7 +59,7 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory 0; } } diff --git a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeMaker.java b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeMaker.java index 66c2bb29e..a5b081a80 100644 --- a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeMaker.java +++ b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeMaker.java @@ -5,7 +5,6 @@ import java.util.List; import com.google.common.collect.ImmutableList; import forestry.core.config.Constants; -import forestry.factory.recipes.BottlerRecipe; import mezz.jei.api.ingredients.IIngredientRegistry; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.Fluid; @@ -35,8 +34,7 @@ public class BottlerRecipeMaker { if (emptyStack.stackSize == 0) { emptyStack = null; } - BottlerRecipe recipe = new BottlerRecipe(ingredient, drain, emptyStack, false); - recipes.add(new BottlerRecipeWrapper(recipe)); + recipes.add(new BottlerRecipeWrapper(ingredient, drain, emptyStack, false)); addFillRecipe(ingredient, drain.getFluid(), recipes); } else { for (Fluid fluid : FluidRegistry.getRegisteredFluids().values()) { @@ -54,8 +52,7 @@ public class BottlerRecipeMaker { int fill = fillCapability.fill(new FluidStack(fluid, Constants.PROCESSOR_TANK_CAPACITY), true); if (fill > 0) { FluidStack filledFluid = new FluidStack(fluid, fill); - BottlerRecipe recipe = new BottlerRecipe(ingredient, filledFluid, fillStack, true); - recipes.add(new BottlerRecipeWrapper(recipe)); + recipes.add(new BottlerRecipeWrapper(ingredient, filledFluid, fillStack, true)); } } } diff --git a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java index 212c02004..5187a1cca 100644 --- a/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java +++ b/src/main/java/forestry/factory/recipes/jei/bottler/BottlerRecipeWrapper.java @@ -1,29 +1,37 @@ package forestry.factory.recipes.jei.bottler; -import forestry.core.recipes.jei.ForestryRecipeWrapper; -import forestry.factory.recipes.BottlerRecipe; +import javax.annotation.Nullable; + import mezz.jei.api.ingredients.IIngredients; +import mezz.jei.api.recipe.BlankRecipeWrapper; import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; -public class BottlerRecipeWrapper extends ForestryRecipeWrapper { - public BottlerRecipeWrapper(BottlerRecipe recipe) { - super(recipe); +public class BottlerRecipeWrapper extends BlankRecipeWrapper { + public final ItemStack inputStack; + public final FluidStack fluid; + @Nullable + public final ItemStack outputStack; + public final boolean fillRecipe; + + public BottlerRecipeWrapper(ItemStack inputStack, FluidStack fluid, @Nullable ItemStack outputStack, boolean fillRecipe) { + this.inputStack = inputStack; + this.fluid = fluid; + this.outputStack = outputStack; + this.fillRecipe = fillRecipe; } @Override public void getIngredients(IIngredients ingredients) { - BottlerRecipe recipe = getRecipe(); - - ingredients.setInput(ItemStack.class, recipe.inputStack); - if (recipe.outputStack != null) { - ingredients.setOutput(ItemStack.class, recipe.outputStack); + ingredients.setInput(ItemStack.class, inputStack); + if (outputStack != null) { + ingredients.setOutput(ItemStack.class, outputStack); } - if (recipe.fillRecipe) { - ingredients.setInput(FluidStack.class, recipe.fluid); + if (fillRecipe) { + ingredients.setInput(FluidStack.class, fluid); } else { - ingredients.setOutput(FluidStack.class, recipe.fluid); + ingredients.setOutput(FluidStack.class, fluid); } } } diff --git a/src/main/java/forestry/factory/tiles/TileBottler.java b/src/main/java/forestry/factory/tiles/TileBottler.java index 6bea2d03a..5d91aa9a2 100644 --- a/src/main/java/forestry/factory/tiles/TileBottler.java +++ b/src/main/java/forestry/factory/tiles/TileBottler.java @@ -110,14 +110,14 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid if (updateOnInterval(20)) { boolean movedStack = false; - ItemStack leftProcessingStack = getStackInSlot(InventoryBottler.SLOT_LEFT_PROCESSING); - ItemStack rightProcessingStack = getStackInSlot(InventoryBottler.SLOT_RIGHT_PROCESSING); + ItemStack leftProcessingStack = getStackInSlot(InventoryBottler.SLOT_EMPTYING_PROCESSING); + ItemStack rightProcessingStack = getStackInSlot(InventoryBottler.SLOT_FILLING_PROCESSING); if(leftProcessingStack == null){ ItemStack inputStack = getStackInSlot(InventoryBottler.SLOT_INPUT_FULL_CONTAINER); if(inputStack != null){ leftProcessingStack = inputStack.copy(); leftProcessingStack.stackSize = 1; - setInventorySlotContents(InventoryBottler.SLOT_LEFT_PROCESSING, leftProcessingStack); + setInventorySlotContents(InventoryBottler.SLOT_EMPTYING_PROCESSING, leftProcessingStack); decrStackSize(InventoryBottler.SLOT_INPUT_FULL_CONTAINER, 1); movedStack = true; } @@ -127,7 +127,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid if(inputStack != null){ rightProcessingStack = inputStack.copy(); rightProcessingStack.stackSize = 1; - setInventorySlotContents(InventoryBottler.SLOT_RIGHT_PROCESSING, rightProcessingStack); + setInventorySlotContents(InventoryBottler.SLOT_FILLING_PROCESSING, rightProcessingStack); decrStackSize(InventoryBottler.SLOT_INPUT_EMPTY_CONTAINER, 1); movedStack = true; } @@ -176,9 +176,9 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid public boolean workCycle() { FluidHelper.FillStatus status; if(currentRecipe.fillRecipe){ - status = FluidHelper.fillContainers(tankManager, this, InventoryBottler.SLOT_RIGHT_PROCESSING, InventoryBottler.SLOT_OUTPUT_FULL_CONTAINER, currentRecipe.fluid.getFluid(), true); + status = FluidHelper.fillContainers(tankManager, this, InventoryBottler.SLOT_FILLING_PROCESSING, InventoryBottler.SLOT_OUTPUT_FULL_CONTAINER, currentRecipe.fluid.getFluid(), true); }else{ - status = FluidHelper.drainContainers(tankManager, this, InventoryBottler.SLOT_LEFT_PROCESSING, InventoryBottler.SLOT_OUTPUT_EMPTY_CONTAINER, true); + status = FluidHelper.drainContainers(tankManager, this, InventoryBottler.SLOT_EMPTYING_PROCESSING, InventoryBottler.SLOT_OUTPUT_EMPTY_CONTAINER, true); } if(status == FluidHelper.FillStatus.SUCCESS){ currentRecipe = null; @@ -197,7 +197,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid } private void checkFillRecipe(){ - ItemStack emptyCan = getStackInSlot(InventoryBottler.SLOT_RIGHT_PROCESSING); + ItemStack emptyCan = getStackInSlot(InventoryBottler.SLOT_FILLING_PROCESSING); if(emptyCan != null){ FluidStack resource = resourceTank.getFluid(); if (resource == null) { @@ -222,7 +222,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid } private void checkEmptyRecipe(){ - ItemStack filledCan = getStackInSlot(InventoryBottler.SLOT_LEFT_PROCESSING); + ItemStack filledCan = getStackInSlot(InventoryBottler.SLOT_EMPTYING_PROCESSING); if(filledCan != null){ //Empty Container if (currentRecipe == null || !currentRecipe.matchFilled(filledCan) && !currentRecipe.fillRecipe) { @@ -245,12 +245,12 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid @Override public void onPickupFromSlot(int slotIndex, EntityPlayer player) { - if(slotIndex == InventoryBottler.SLOT_LEFT_PROCESSING){ + if(slotIndex == InventoryBottler.SLOT_EMPTYING_PROCESSING){ if(currentRecipe != null && !currentRecipe.fillRecipe){ currentRecipe = null; setTicksPerWorkCycle(0); } - }else if(slotIndex == InventoryBottler.SLOT_RIGHT_PROCESSING){ + }else if(slotIndex == InventoryBottler.SLOT_FILLING_PROCESSING){ if(currentRecipe != null && currentRecipe.fillRecipe){ currentRecipe = null; setTicksPerWorkCycle(0); @@ -277,7 +277,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid @Override public boolean hasResourcesMin(float percentage) { IInventoryAdapter inventory = getInternalInventory(); - ItemStack emptyCan = inventory.getStackInSlot(InventoryBottler.SLOT_RIGHT_PROCESSING); + ItemStack emptyCan = inventory.getStackInSlot(InventoryBottler.SLOT_FILLING_PROCESSING); if (emptyCan == null) { return false; } @@ -296,7 +296,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid if (currentRecipe != null) { IFluidTankProperties properties = tankManager.getTankProperties()[0]; if(properties != null){ - emptyStatus = FluidHelper.drainContainers(tankManager, this, InventoryBottler.SLOT_LEFT_PROCESSING, InventoryBottler.SLOT_OUTPUT_EMPTY_CONTAINER, false); + emptyStatus = FluidHelper.drainContainers(tankManager, this, InventoryBottler.SLOT_EMPTYING_PROCESSING, InventoryBottler.SLOT_OUTPUT_EMPTY_CONTAINER, false); }else{ emptyStatus = FillStatus.SUCCESS; } @@ -308,7 +308,7 @@ public class TileBottler extends TilePowered implements ISidedInventory, ILiquid if (currentRecipe == null) { return false; }else{ - fillStatus = FluidHelper.fillContainers(tankManager, this, InventoryBottler.SLOT_RIGHT_PROCESSING, InventoryBottler.SLOT_OUTPUT_FULL_CONTAINER, currentRecipe.fluid.getFluid(), false); + fillStatus = FluidHelper.fillContainers(tankManager, this, InventoryBottler.SLOT_FILLING_PROCESSING, InventoryBottler.SLOT_OUTPUT_FULL_CONTAINER, currentRecipe.fluid.getFluid(), false); } }else{ return true;