Interface EnchantAction
- All Known Implementing Classes:
EnchantAction.Apply,EnchantAction.None,EnchantAction.Reroll,EnchantAction.Transfer,EnchantAction.Upgrade
public sealed interface EnchantAction
permits EnchantAction.Upgrade, EnchantAction.Transfer, EnchantAction.Apply, EnchantAction.Reroll, EnchantAction.None
A sealed interface defining the concrete mutation operations that can be performed
by the Enchanting Altar upon the player's inventory.
Acts as the Command Pattern interface for menu interactions. Each valid implementation manages its own specific logic for modifying the target item, deducting resource costs, and handling source catalyst consumption.
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final recordAction representing a newly generated enchantment randomly supplied by the table itself.static final recordA non-action representing a slot that is visually present but functionally disabled.static final recordAction representing a manual re-roll of the table's deterministic seed.static final recordAction representing the transfer of an enchantment from a source book to the target item.static final recordAction representing an upgrade to an existing enchantment on the target item. -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecute(net.minecraft.world.entity.player.Player player, net.minecraft.world.Container inventory) Executes the enchantment action, modifying the container and player state.
-
Method Details
-
execute
boolean execute(net.minecraft.world.entity.player.Player player, net.minecraft.world.Container inventory) Executes the enchantment action, modifying the container and player state.- Parameters:
player- The player executing the action.inventory- The active inventory container holding the target, fuel, and source.- Returns:
- true if the action was successfully performed, false if it failed (e.g., due to insufficient funds).
-