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.

Импорт класса

Link to импорт-класса

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
Copy
import crafttweaker.api.event.block.BlockToolInteractEvent;

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();

Link to getHeldItemStack

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.

ZenScript
Copy
BlockToolInteractEvent.setFinalState(state as BlockState)
ПараметрТип
Параметр
state
Тип
BlockState

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
finalState
Тип
BlockState?
Имеет Getter
true
Имеет Setter
true
Описание
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.
Название
heldItemStack
Тип
IItemStack
Имеет Getter
true
Имеет Setter
false
Описание
Название
player
Тип
Player
Имеет Getter
true
Имеет Setter
false
Описание
Название
toolAction
Тип
ToolAction
Имеет Getter
true
Имеет Setter
false
Описание