MCBlockToolInteractEvent

Link to mcblocktoolinteractevent

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.MCBlockToolInteractEvent;

Extending MCBlockEvent

Link to extending-mcblockevent

MCBlockToolInteractEvent extends MCBlockEvent. That means all methods available in MCBlockEvent are also available in MCBlockToolInteractEvent

Link to g-

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: MCBlockState?

ZenScript
Copy
// MCBlockToolInteractEvent.getFinalState() as MCBlockState?

myMCBlockToolInteractEvent.getFinalState();

Link to g--1

Name: getHeldItemStack

Return Type: IItemStack

ZenScript
Copy
// MCBlockToolInteractEvent.getHeldItemStack() as IItemStack

myMCBlockToolInteractEvent.getHeldItemStack();

Link to g--2

Name: getPlayer

Return Type: MCPlayerEntity

ZenScript
Copy
// MCBlockToolInteractEvent.getPlayer() as MCPlayerEntity

myMCBlockToolInteractEvent.getPlayer();

Link to g--3

Name: getToolType

Return Type: ToolType

ZenScript
Copy
// MCBlockToolInteractEvent.getToolType() as ToolType

myMCBlockToolInteractEvent.getToolType();

Link to g--4

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
Copy
MCBlockToolInteractEvent.setFinalState(state as MCBlockState) as void
ПараметрТипОписание
Параметр
state
Тип
MCBlockState
Описание
No Description Provided

Свойства

Link to свойства

НазваниеТипИмеет GetterИмеет SetterОписание
Название
finalState
Тип
MCBlockState?
Имеет 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
Описание
No Description Provided
Название
player
Тип
MCPlayerEntity
Имеет Getter
true
Имеет Setter
false
Описание
No Description Provided
Название
toolType
Тип
ToolType
Имеет Getter
true
Имеет Setter
false
Описание
No Description Provided