diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java index 6fb7e05e9..c2c9e3d7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoalGenerator.java @@ -79,7 +79,7 @@ public class TileEntityCoalGenerator extends TileEntityInventoryBase implements this.maxBurnTime = burnTime; this.currentBurnTime = burnTime; - this.slots[0] = StackUtil.addStackSize(this.slots[0], -1); + this.slots[0] = StackUtil.addStackSize(this.slots[0], -1, true); } if(flag != this.currentBurnTime > 0){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 32b0402d6..950600fd4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -157,7 +157,7 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements CoffeeIngredient ingredient = ItemCoffee.getIngredientFromStack(this.slots[i]); if(ingredient != null){ if(ingredient.effect(output)){ - this.slots[i] = StackUtil.addStackSize(this.slots[i], -1); + this.slots[i] = StackUtil.addStackSize(this.slots[i], -1, true); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java index ccfbfab57..9b5940b78 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StackUtil.java @@ -50,8 +50,12 @@ public final class StackUtil{ } public static ItemStack setStackSize(ItemStack stack, int size){ + return setStackSize(stack, size, false); + } + + public static ItemStack setStackSize(ItemStack stack, int size, boolean containerOnEmpty){ if(size <= 0){ - if(isValid(stack)){ + if(isValid(stack) && containerOnEmpty){ return stack.getItem().getContainerItem(stack); } else{ @@ -63,6 +67,11 @@ public final class StackUtil{ } public static ItemStack addStackSize(ItemStack stack, int size){ - return setStackSize(stack, getStackSize(stack)+size); + return addStackSize(stack, size, false); } + + public static ItemStack addStackSize(ItemStack stack, int size, boolean containerOnEmpty){ + return setStackSize(stack, getStackSize(stack)+size, containerOnEmpty); + } + }