use of net.dries007.tfc.common.recipes.PotRecipe in project TerraFirmaCraft by TerraFirmaCraft.
the class PotBlockEntity method handleCooking.
@Override
protected void handleCooking() {
if (isBoiling()) {
assert cachedRecipe != null;
if (boilingTicks < cachedRecipe.getDuration()) {
boilingTicks++;
if (boilingTicks == 1)
markForSync();
} else {
// Create output
// Save the recipe here, as setting inventory will call setAndUpdateSlots, which will clear the cached recipe before output is created
final PotRecipe recipe = cachedRecipe;
final PotRecipe.Output output = recipe.getOutput(inventory);
// Clear inputs
inventory.tank.setFluid(FluidStack.EMPTY);
for (int slot = SLOT_EXTRA_INPUT_START; slot <= SLOT_EXTRA_INPUT_END; slot++) {
// Consume items, but set container items if they exist
inventory.setStackInSlot(slot, inventory.getStackInSlot(slot).getContainerItem());
}
// Let the output handle filling into the empty pot
output.onFinish(inventory);
if (// Then, if we still have contents, save the output
!output.isEmpty()) {
this.output = output;
}
// Reset recipe progress
cachedRecipe = null;
boilingTicks = 0;
updateCachedRecipe();
markForSync();
}
} else if (// catch accidentally not syncing when it dips below temperature
boilingTicks > 0) {
boilingTicks = 0;
markForSync();
}
}
use of net.dries007.tfc.common.recipes.PotRecipe in project TerraFirmaCraft by TerraFirmaCraft.
the class SimplePotRecipeCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayoutBuilder builder, PotRecipe potRecipe, IFocusGroup focuses) {
super.setRecipe(builder, potRecipe, focuses);
SimplePotRecipe recipe = (SimplePotRecipe) potRecipe;
FluidStack displayFluid = recipe.getDisplayFluid();
if (!displayFluid.isEmpty()) {
IRecipeSlotBuilder fluidOutput = builder.addSlot(RecipeIngredientRole.OUTPUT, 132, 26);
fluidOutput.addIngredient(VanillaTypes.FLUID, displayFluid);
fluidOutput.setFluidRenderer(1, false, 16, 16);
fluidOutput.setSlotName("fluidOutput");
}
List<ItemStack> outputStacks = recipe.getOutputStacks();
if (!outputStacks.isEmpty()) {
// todo: temporarily just adding the first output so JEI picks up the output stuff, we need to show up to all 5
IRecipeSlotBuilder itemOutput = builder.addSlot(RecipeIngredientRole.OUTPUT, 132, 6);
itemOutput.addItemStack(outputStacks.get(0));
itemOutput.setSlotName("output1");
}
}
Aggregations