Class PressureChamberRecipeImpl
java.lang.Object
me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
me.desht.pneumaticcraft.api.crafting.recipe.PressureChamberRecipe
me.desht.pneumaticcraft.common.recipes.machine.PressureChamberRecipeImpl
- All Implemented Interfaces:
net.minecraft.world.item.crafting.Recipe<PneumaticCraftRecipe.DummyIInventory>
- Direct Known Subclasses:
PressureDisenchantingRecipe,PressureEnchantingRecipe
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classNested classes/interfaces inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PressureChamberRecipe
PressureChamberRecipe.RecipeSlot, PressureChamberRecipe.SlotCycleNested classes/interfaces inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
PneumaticCraftRecipe.DummyIInventory -
Constructor Summary
ConstructorsConstructorDescriptionPressureChamberRecipeImpl(net.minecraft.resources.ResourceLocation id, List<net.minecraft.world.item.crafting.Ingredient> inputs, float pressureRequired, net.minecraft.world.item.ItemStack... outputs) -
Method Summary
Modifier and TypeMethodDescriptionnet.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack>craftRecipe(net.minecraftforge.items.IItemHandler chamberHandler, List<Integer> ingredientSlots, boolean simulate) This method is called when the Pressure Chamber is ready to craft with this recipe, and will only be called whenPressureChamberRecipe.findIngredients(IItemHandler)returns a non-empty list of slot numbers, i.e.findIngredients(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.floatgetCraftingPressure(net.minecraftforge.items.IItemHandler chamberHandler, List<Integer> ingredientSlots) Returns the minimum pressure required to craft the recipe.floatGet the required crafting pressure for the items specified byPressureChamberRecipe.getInputsForDisplay(), for display purposes only (e.g.getGroup()List<net.minecraft.world.item.crafting.Ingredient>Get the input items for this recipe.net.minecraft.world.item.crafting.RecipeSerializer<?>protected List<net.minecraft.world.item.ItemStack>Implement if no output slots display more than one stack.net.minecraft.world.item.ItemStacknet.minecraft.world.item.crafting.RecipeType<?>getType()booleanisValidInputItem(net.minecraft.world.item.ItemStack stack) Check if the given item is a valid input item for this recipe.voidwrite(net.minecraft.network.FriendlyByteBuf buffer) Writes this recipe to a PacketBuffer.Methods inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PressureChamberRecipe
getResultsForDisplay, getSyncForDisplay, getSyncGroupsForDisplay, getTooltipKeyMethods inherited from class me.desht.pneumaticcraft.api.crafting.recipe.PneumaticCraftRecipe
assemble, canCraftInDimensions, getId, getResultItem, isSpecial, matchesMethods 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
getIngredients, getRemainingItems, isIncomplete
-
Constructor Details
-
PressureChamberRecipeImpl
public PressureChamberRecipeImpl(net.minecraft.resources.ResourceLocation id, List<net.minecraft.world.item.crafting.Ingredient> inputs, float pressureRequired, net.minecraft.world.item.ItemStack... outputs)
-
-
Method Details
-
getCraftingPressure
public float getCraftingPressure(net.minecraftforge.items.IItemHandler chamberHandler, List<Integer> ingredientSlots) Description copied from class:PressureChamberRecipeReturns 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.- Specified by:
getCraftingPressurein classPressureChamberRecipe- Parameters:
chamberHandler- what's currently in the pressure chamberingredientSlots- a list of slots inchamberHandler(as returned byPressureChamberRecipe.findIngredients(IItemHandler)) where the ingredients can be found- Returns:
- threshold pressure
-
getCraftingPressureForDisplay
public float getCraftingPressureForDisplay()Description copied from class:PressureChamberRecipeGet the required crafting pressure for the items specified byPressureChamberRecipe.getInputsForDisplay(), for display purposes only (e.g. for JEI)- Specified by:
getCraftingPressureForDisplayin classPressureChamberRecipe
-
findIngredients
Description copied from class:PressureChamberRecipeWhen 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 toPressureChamberRecipe.getCraftingPressure(IItemHandler, List)andPressureChamberRecipe.craftRecipe(IItemHandler, List, boolean)by the pressure chamber.Do not cache this list across ticks, since the chamber contents are quite likely to change in the meantime.
- Specified by:
findIngredientsin classPressureChamberRecipe- 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
Description copied from class:PressureChamberRecipeGet the input items for this recipe. This is primarily intended for recipe display purposes by JEI or any other recipe display mod.- Specified by:
getInputsForDisplayin classPressureChamberRecipe
-
getSingleResultsForDisplay
Description copied from class:PressureChamberRecipeImplement if no output slots display more than one stack.- Overrides:
getSingleResultsForDisplayin classPressureChamberRecipe- See Also:
-
getType
public net.minecraft.world.item.crafting.RecipeType<?> getType() -
getSerializer
public net.minecraft.world.item.crafting.RecipeSerializer<?> getSerializer() -
getGroup
-
getToastSymbol
public net.minecraft.world.item.ItemStack getToastSymbol() -
isValidInputItem
public boolean isValidInputItem(net.minecraft.world.item.ItemStack stack) Description copied from class:PressureChamberRecipeCheck 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.- Specified by:
isValidInputItemin classPressureChamberRecipe- Parameters:
stack- item stack to check- Returns:
- true if this is a valid item, false otherwise
-
craftRecipe
@Nonnull public net.minecraft.core.NonNullList<net.minecraft.world.item.ItemStack> craftRecipe(@Nonnull net.minecraftforge.items.IItemHandler chamberHandler, List<Integer> ingredientSlots, boolean simulate) Description copied from class:PressureChamberRecipeThis method is called when the Pressure Chamber is ready to craft with this recipe, and will only be called whenPressureChamberRecipe.findIngredients(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.- Specified by:
craftRecipein classPressureChamberRecipe- 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 fromPressureChamberRecipe.findIngredients(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
-
write
public void write(net.minecraft.network.FriendlyByteBuf buffer) Description copied from class:PneumaticCraftRecipeWrites this recipe to a PacketBuffer.- Specified by:
writein classPneumaticCraftRecipe- Parameters:
buffer- The buffer to write to.
-