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>
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 Summary
ConstructorsConstructorDescriptionCraftRecipeEvent(com.hypixel.hytale.server.core.event.events.ecs.CraftRecipeEvent.Pre originalEvent, Player player) Constructs a new CraftRecipeEvent. -
Method Summary
Modifier and TypeMethodDescriptioncom.hypixel.hytale.server.core.asset.type.item.config.CraftingRecipeGets the crafting recipe being used.Gets the player who crafted the recipe.intGets the quantity being crafted.Gets the name/ID of the recipe.booleanChecks if this event has been cancelled.voidsetCancelled(boolean cancelled) Sets the cancelled state of this event.
-
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 eventplayer- 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
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
Gets the player who crafted the recipe.- Returns:
- the player, or null if the recipe was not crafted by a player
-