Class PressureChamberRecipe
java.lang.Object
me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
me.desht.pneumaticcraft.api.crafting.recipe.PressureChamberRecipe
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<PneumaticCraftRecipe.DummyIInventory>
- Direct Known Subclasses:
PressureChamberRecipeImpl
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final recordData object for type of slot and the index of the slot.static final recordData object for storing aPressureChamberRecipe.RecipeSlotand a cycle represented as a list of indices for the slot.Nested classes/interfaces inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
PneumaticCraftRecipe.DummyIInventory -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedPressureChamberRecipe(net.minecraft.resources.ResourceLocation id) -
Method Summary
Modifier and TypeMethodDescriptionabstract net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>craftRecipe(net.minecraftforge.items.IItemHandler chamberHandler, it.unimi.dsi.fastutil.ints.IntList ingredientSlots, boolean simulate) This method is called when the Pressure Chamber is ready to craft with this recipe, and will only be called whenfindIngredients(IItemHandler)returns a non-empty list of slot numbers, i.e.abstract it.unimi.dsi.fastutil.ints.IntCollectionfindIngredients(net.minecraftforge.items.IItemHandler chamberHandler) When called (by the pressure chamber BE when it detects a change in the chamber contents), try to find the ingredients for this recipe in the given item handler, which represents all the items currently in the pressure chamber.abstract floatgetCraftingPressure(net.minecraftforge.items.IItemHandler chamberHandler, it.unimi.dsi.fastutil.ints.IntList ingredientSlots) Returns the minimum pressure required to craft the recipe.abstract floatGet the required crafting pressure for the items specified bygetInputsForDisplay(), for display purposes only (e.g.abstract List<net.minecraft.world.item.crafting.Ingredient>Get the input items for this recipe.Get the output of this recipe, without crafting it.protected List<net.minecraft.world.item.ItemStack>Implement if no output slots display more than one stack.Map<PressureChamberRecipe.RecipeSlot,it.unimi.dsi.fastutil.ints.IntList> getSyncForDisplay(PressureChamberRecipe.SlotCycle focusedSlotCycle) Get the slots and associated cycles that are synchronized with the given focused slot and matched cycle indices.protected List<Set<PressureChamberRecipe.RecipeSlot>>Get the slots that are synchronized with each other.getTooltipKey(boolean input, String slotName) Return a translation key for a supplementary tooltip to be displayed on the ingredient or resulting item.abstract booleanisValidInputItem(net.minecraft.world.item.ItemStack stack) Check if the given item is a valid input item for this recipe.Methods inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
assemble, canCraftInDimensions, getId, getResultItem, isSpecial, matches, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface net.minecraft.world.item.crafting.Recipe
getGroup, getIngredients, getRemainingItems, getSerializer, getToastSymbol, getType, isIncomplete, showNotification
-
Constructor Details
-
PressureChamberRecipe
protected PressureChamberRecipe(net.minecraft.resources.ResourceLocation id)
-
-
Method Details
-
getCraftingPressure
public abstract float getCraftingPressure(net.minecraftforge.items.IItemHandler chamberHandler, it.unimi.dsi.fastutil.ints.IntList ingredientSlots) Returns the minimum pressure required to craft the recipe. Negative pressures are also acceptable; in this case the pressure chamber's pressure must be lower than the required pressure.- Parameters:
chamberHandler- what's currently in the pressure chamberingredientSlots- a list of slots inchamberHandler(as returned byfindIngredients(IItemHandler)) where the ingredients can be found- Returns:
- threshold pressure
-
getCraftingPressureForDisplay
public abstract float getCraftingPressureForDisplay()Get the required crafting pressure for the items specified bygetInputsForDisplay(), for display purposes only (e.g. for JEI) -
findIngredients
public abstract it.unimi.dsi.fastutil.ints.IntCollection findIngredients(@Nonnull net.minecraftforge.items.IItemHandler chamberHandler) When called (by the pressure chamber BE when it detects a change in the chamber contents), try to find the ingredients for this recipe in the given item handler, which represents all the items currently in the pressure chamber. You must return a collection of slot indices into the item handler which contain the matching ingredients; those indices will be passed promptly togetCraftingPressure(IItemHandler, IntList)andcraftRecipe(IItemHandler, IntList, boolean)by the pressure chamber.Do not cache this list across ticks, since the chamber contents are quite likely to change in the meantime.
- Parameters:
chamberHandler- what's currently in the pressure chamber- Returns:
- if this recipe is valid, a list of slots in the item handler where the ingredients can be found; otherwise, an empty list
-
getInputsForDisplay
Get the input items for this recipe. This is primarily intended for recipe display purposes by JEI or any other recipe display mod. -
getSingleResultsForDisplay
Implement if no output slots display more than one stack.- See Also:
-
getResultsForDisplay
Get the output of this recipe, without crafting it. This is intended for recipe display purposes by JEI, Patchouli, or any other recipe display mod.If overriding and no output slots display more than one stack then can override
getSingleResultsForDisplay()instead. -
getSyncGroupsForDisplay
Get the slots that are synchronized with each other. They must have the same cycle length and not intersect.A sync group (represented by a set of
PressureChamberRecipe.RecipeSlots) will have all its member's cycles synchronized should one of the members be the focus for a recipe lookup.If you need more functionality, see
getSyncForDisplay(SlotCycle).- Returns:
- List of sync groups represented by a set of
PressureChamberRecipe.RecipeSlots
-
getSyncForDisplay
public Map<PressureChamberRecipe.RecipeSlot,it.unimi.dsi.fastutil.ints.IntList> getSyncForDisplay(PressureChamberRecipe.SlotCycle focusedSlotCycle) Get the slots and associated cycles that are synchronized with the given focused slot and matched cycle indices. Prefer overridinggetSyncGroupsForDisplay()unless you need special handling.This method is called when a recipe lookup is done through JEI that has a focus.
- Parameters:
focusedSlotCycle- Slot and indices of the slot's cycle that matches with the focus- Returns:
- Synchronizations for the given slot cycle
-
isValidInputItem
public abstract boolean isValidInputItem(net.minecraft.world.item.ItemStack stack) Check if the given item is a valid input item for this recipe. This should also be true even if the number of items in the given item stack is smaller than the number required by the recipe; this is testing for item type, not item count.- Parameters:
stack- item stack to check- Returns:
- true if this is a valid item, false otherwise
-
craftRecipe
@Nonnull public abstract net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> craftRecipe(@Nonnull net.minecraftforge.items.IItemHandler chamberHandler, it.unimi.dsi.fastutil.ints.IntList ingredientSlots, boolean simulate) This method is called when the Pressure Chamber is ready to craft with this recipe, and will only be called whenfindIngredients(IItemHandler)returns a non-empty list of slot numbers, i.e. the necessary items are definitely in the chamber. The implementation is responsible for removing the items that have been used from thechamberHandler. The implementation must also return the list of crafted items, for the Pressure Chamber to insert into its output item handler.- Parameters:
chamberHandler- items in the pressure chamber; should be modified to remove recipe input items.ingredientSlots- slots in the chamber handler where the ingredients can be found, as returned fromfindIngredients(IItemHandler)simulate- pass on to uses ofchamberHandler- Returns:
- the resulting items; these do not have to be copies, since the Pressure Chamber itself will insert copies of these items
-
getTooltipKey
Return a translation key for a supplementary tooltip to be displayed on the ingredient or resulting item. For use in recipe display systems such as JEI (PNC's JEI integration names slots as "in{N}" and "out{N}" where n >= 0)- Parameters:
input- true if this is an input item, false if an output itemslotName- a unique slot name- Returns:
- a tooltip translation key, or "" for no tooltip
-