Class CraftRecipeEvent

java.lang.Object
fr.hytale.loader.event.types.ecs.CraftRecipeEvent
All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>

public class CraftRecipeEvent extends Object implements com.hypixel.hytale.event.IEvent<Void>
Called when a crafting recipe is executed (ECS event).

This is an ECS-level crafting event that fires during the crafting process. It provides access to the recipe being crafted and the quantity. The event can be cancelled to prevent the craft from completing.

Note: This is different from PlayerCraftEvent which is a player-specific event.

Since:
1.0.1
Version:
1.0.4
Author:
HytaleLoader
  • Constructor Details

    • CraftRecipeEvent

      public CraftRecipeEvent(com.hypixel.hytale.server.core.event.events.ecs.CraftRecipeEvent.Pre originalEvent, Player player)
      Constructs a new CraftRecipeEvent.
      Parameters:
      originalEvent - the original Hytale ECS event
      player - the player who crafted the recipe, or null if not a player
  • Method Details

    • getCraftedRecipe

      public com.hypixel.hytale.server.core.asset.type.item.config.CraftingRecipe getCraftedRecipe()
      Gets the crafting recipe being used.
      Returns:
      the crafting recipe
    • getQuantity

      public int getQuantity()
      Gets the quantity being crafted.
      Returns:
      the number of items being crafted
    • getRecipeName

      public String getRecipeName()
      Gets the name/ID of the recipe.
      Returns:
      the recipe ID, or "Unknown" if not available
    • isCancelled

      public boolean isCancelled()
      Checks if this event has been cancelled.
      Returns:
      true if cancelled, false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets the cancelled state of this event.
      Parameters:
      cancelled - true to cancel, false to allow
    • getPlayer

      public Player getPlayer()
      Gets the player who crafted the recipe.
      Returns:
      the player, or null if the recipe was not crafted by a player