public boolean canFreeze() { if (inventory[0] == null && timeRemaining == 0) { return false; } if (inventory[0] != null && timeRemaining == 0) { if (!isFuel(inventory[0])) { return false; } } if (inventory[1] != null) { RecipeData data = Recipes.getFreezerRecipeFromInput(inventory[1]); if (data == null) { return false; } if (inventory[2] == null) { return true; } if (inventory[2].getItem() != data.getOutput().getItem()) { return false; } if (inventory[2].stackSize < this.getInventoryStackLimit() && inventory[2].stackSize < inventory[2].getMaxStackSize()) { return true; } } return false; }
public void freezeItem() { if (inventory[1] != null) { RecipeData data = Recipes.getFreezerRecipeFromInput(inventory[1]); if (data == null) { return; } if (inventory[2] == null) { inventory[2] = data.getOutput().copy(); } else if (inventory[2].getItem() == data.getOutput().getItem() && inventory[2].getItemDamage() == data.getOutput().getItemDamage()) { inventory[2].stackSize += data.getOutput().copy().stackSize; } if (inventory[1].getItem().hasContainerItem()) { inventory[1] = new ItemStack(inventory[1].getItem().getContainerItem()); } else { inventory[1].stackSize--; } if (inventory[1].stackSize <= 0) { inventory[1] = null; } } }