BlockToolInteractEvent
Link to blocktoolinteractevent
Fired when when this block is right clicked by a tool to change its state. For example: Used to determine if an axe can strip a log, a shovel can turn grass into a path, or a hoe can till dirt into farmland.
The event is cancelable.
If the event is canceled, this will prevent the tool from changing the block's state.
The event does not have a result.
Importare la Classe
Link to importare-la-classe
It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.
ZenScript Copyimport crafttweaker.api.event.block.BlockToolInteractEvent;
Extending BlockEvent
Link to extending-blockevent
BlockToolInteractEvent extends BlockEvent. That means all methods available in BlockEvent are also available in BlockToolInteractEvent
Metodi
Link to metodi
Name: getFinalState
Gets the transformed state after tool use. If setFinalState is not called, it will return the original state. This will be bypassed if canceled, returning null instead.
Return Type: BlockState
ZenScript Copy// BlockToolInteractEvent.getFinalState() as BlockState
myBlockToolInteractEvent.getFinalState();
Name: getHeldItemStack
Return Type: IItemStack
ZenScript Copy// BlockToolInteractEvent.getHeldItemStack() as IItemStack
myBlockToolInteractEvent.getHeldItemStack();
Name: getPlayer
Return Type: Player
ZenScript Copy// BlockToolInteractEvent.getPlayer() as Player
myBlockToolInteractEvent.getPlayer();
Name: getToolType
Return Type: ToolAction
ZenScript Copy// BlockToolInteractEvent.getToolType() as ToolAction
myBlockToolInteractEvent.getToolType();
Name: setFinalState
Sets the transformed state after tool use. If not set, will return the original state. This will be bypassed if canceled, returning null instead.
Return Type: void
ZenScript CopyBlockToolInteractEvent.setFinalState(state as BlockState) as void
Parametro | Tipo | Descrizione |
---|---|---|
Parametro state | Tipo BlockState | Descrizione No Description Provided |
Proprietà
Link to proprietà
Nome | Tipo | Ha Getter | Ha Setter | Descrizione |
---|---|---|---|---|
Nome finalState | Tipo BlockState | Ha Getter sì | Ha Setter sì | Descrizione Gets the transformed state after tool use. If setFinalState is not called, it will return the original state. This will be bypassed if canceled, returning null instead. |
Nome heldItemStack | Tipo IItemStack | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome player | Tipo Player | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |
Nome toolAction | Tipo ToolAction | Ha Getter sì | Ha Setter no | Descrizione No Description Provided |