Package org.quiltmc.qsl.item.setting.api
Interface RecipeRemainderLogicHandler
@NonExtendable
public interface RecipeRemainderLogicHandler
Handles most logic for stack-aware recipe remainders.
This can be used by custom
Recipe crafting systems.-
Method Summary
Static MethodsModifier and TypeMethodDescriptionstatic net.minecraft.item.ItemStackgetRemainder(net.minecraft.item.ItemStack original, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location) Gets the stack-aware remainder of the providedItemStackfor the providedRecipe.static voidhandleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, int amount, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, Consumer<net.minecraft.item.ItemStack> failure) Handles the recipe remainder logic for crafts without aplayerpresent.static voidhandleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, int amount, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Handles the recipe remainder logic for crafts without aplayerpresent.static voidhandleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) static voidhandleRemainderForScreenHandler(net.minecraft.screen.slot.Slot slot, int amount, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.entity.player.PlayerEntity player) Handles the recipe remainder logic for crafts within ascreen handler.static voidhandleRemainderForScreenHandler(net.minecraft.screen.slot.Slot slot, @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.entity.player.PlayerEntity player)
-
Method Details
-
getRemainder
static net.minecraft.item.ItemStack getRemainder(net.minecraft.item.ItemStack original, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location) Gets the stack-aware remainder of the providedItemStackfor the providedRecipe.- Parameters:
original- the stack to decrementrecipe- the recipe being usedlocation- the remainder location- Returns:
- the recipe remainder
-
handleRemainderForNonPlayerCraft
@Contract(mutates="param1, param5, param7") static void handleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, int amount, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) Handles the recipe remainder logic for crafts without aplayerpresent. Excess items that cannot be returned to a slot are dropped in the world.- Parameters:
input- the original item stackamount- the amount by which to decrease the stackrecipe- the recipe being usedlocation- the remainder locationinventory- the inventoryindex- the index of the original stack in the inventoryworld- the worldpos- the location to drop excess remainders
-
handleRemainderForNonPlayerCraft
@Contract(mutates="param1, param5, param7") static void handleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, int amount, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, Consumer<net.minecraft.item.ItemStack> failure) Handles the recipe remainder logic for crafts without aplayerpresent. Excess items that cannot be returned to a slot are handled by the providedconsumer.- Parameters:
input- the original item stackamount- the amount by which to decrease the stackrecipe- the recipe being usedlocation- the remainder locationinventory- the inventoryindex- the index of the original stack in the inventoryfailure- callback that is run if excess items could not be returned to a slot
-
handleRemainderForNonPlayerCraft
@Contract(mutates="param1, param4, param6") static void handleRemainderForNonPlayerCraft(net.minecraft.item.ItemStack input, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.util.collection.DefaultedList<net.minecraft.item.ItemStack> inventory, int index, net.minecraft.world.World world, net.minecraft.util.math.BlockPos pos) - See Also:
-
handleRemainderForScreenHandler
@Contract(mutates="param1, param5") static void handleRemainderForScreenHandler(net.minecraft.screen.slot.Slot slot, int amount, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.entity.player.PlayerEntity player) Handles the recipe remainder logic for crafts within ascreen handler. Excess items that cannot be returned to a slot are offered to the player or dropped.- Parameters:
slot- the slot of the original stackamount- the amount by which to decrease the stackrecipe- the recipe being usedlocation- the remainder locationplayer- the player performing the craft
-
handleRemainderForScreenHandler
@Contract(mutates="param1, param4") static void handleRemainderForScreenHandler(net.minecraft.screen.slot.Slot slot, @Nullable @Nullable net.minecraft.recipe.Recipe<?> recipe, RecipeRemainderLocation location, net.minecraft.entity.player.PlayerEntity player) - See Also:
-