public void markRecipeChanges() { hasRecipeChanges = true; if (isActive) { processOff(); } }
@Override protected void postAugmentInstall() { super.postAugmentInstall(); if (!augmentTank) { tank.drain(tank.getCapacity(), true); if (usingTank) { processOff(); } usingTank = false; } }
public void setRecipe() { for (int i = 0; i < 9; i++) { craftMatrix.setInventorySlotContents(i, inventory[i + SLOT_CRAFTING_START]); } IRecipe newRecipe = CraftingManager.findMatchingRecipe(craftMatrix, world); ItemStack stack = ItemStack.EMPTY; if (newRecipe != null) { stack = newRecipe.getCraftingResult(craftMatrix); craftRecipe = CrafterRecipe.getRecipe(newRecipe, this); if (craftRecipe == null) { newRecipe = null; stack = ItemStack.EMPTY; usingTank = false; } } else { craftRecipe = null; usingTank = false; } if (craftRecipe == null) { if (isActive) { processOff(); } } inventory[SLOT_CRAFTING_START + 9] = stack; craftResult.setRecipeUsed(newRecipe); craftResult.setInventorySlotContents(0, inventory[SLOT_CRAFTING_START + 9]); clearRecipeChanges(); }
@Override protected void processFinish() { IRecipe recipe = craftResult.getRecipeUsed(); if (recipe == null || !checkIngredients()) { processOff(); return; } craftRecipe.evaluate(); ItemStack output = recipe.getCraftingResult(craftMatrix); NonNullList<ItemStack> remainingItems = recipe.getRemainingItems(craftMatrix); for (int i = 0; i < remainingItems.size(); i++) { ItemStack remaining = remainingItems.get(i); if (!remaining.isEmpty() && !craftRecipe.isFalseBucket(i)) { for (int j = 0; j < SLOT_OUTPUT; j++) { if (inventory[j].isEmpty()) { inventory[j] = remaining; break; } else if (remaining.getMaxStackSize() > 1 && ItemHelper.itemsIdentical(inventory[j], remaining) && inventory[j].getCount() < inventory[j].getMaxStackSize()) { inventory[j].grow(1); break; } } } } if (inventory[SLOT_OUTPUT].isEmpty()) { inventory[SLOT_OUTPUT] = ItemHelper.cloneStack(output); } else { inventory[SLOT_OUTPUT].grow(output.getCount()); } }