mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-27 01:08:34 +01:00
make only coffee machine and coal generator return their container item
This commit is contained in:
parent
142b5d394f
commit
2cc5d02814
3 changed files with 13 additions and 4 deletions
|
@ -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){
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue