Class FurnaceSmeltFunction
java.lang.Object
com.github.darksoulq.abyssallib.world.data.loot.LootFunction
com.github.darksoulq.abyssallib.world.data.loot.function.FurnaceSmeltFunction
A loot function that attempts to smelt the generated item stack.
This function iterates through the server's recipe registry to find a
FurnaceRecipe that accepts the current item as an input. If a
match is found, the item is replaced with the smelting result while
maintaining the original stack size.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final Codec<FurnaceSmeltFunction> The codec used for serializing and deserializing the furnace smelt function.static final LootFunctionType<FurnaceSmeltFunction> The registered type definition for the furnace smelt loot function. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionorg.bukkit.inventory.ItemStackapply(org.bukkit.inventory.ItemStack stack, LootContext context) Applies the smelting transformation to the generatedItemStack.getType()Retrieves the specific type definition for this loot function.
-
Field Details
-
CODEC
The codec used for serializing and deserializing the furnace smelt function.As this function logic is procedural and carries no unique configuration state, it encodes to and decodes from an empty map structure.
-
TYPE
The registered type definition for the furnace smelt loot function.
-
-
Constructor Details
-
FurnaceSmeltFunction
public FurnaceSmeltFunction()
-
-
Method Details
-
apply
public org.bukkit.inventory.ItemStack apply(org.bukkit.inventory.ItemStack stack, LootContext context) Applies the smelting transformation to the generatedItemStack.Scans the global
* @param stack TheBukkit.recipeIterator()for aFurnaceRecipe. If the input material of a recipe matches the material of the provided stack, the stack is transformed into the recipe result.ItemStackgenerated by the loot entry.- Specified by:
applyin classLootFunction- Parameters:
stack- TheItemStackto be modified.context- TheLootContextproviding environmental data.- Returns:
- The smelted
ItemStackif a recipe exists; otherwise, the original stack.
-
getType
Retrieves the specific type definition for this loot function. * @return TheLootFunctionTypeassociated withFurnaceSmeltFunction.- Specified by:
getTypein classLootFunction- Returns:
- The
LootFunctionTypeused for registry identification and serialization.
-