LeftClickBlockEvent

Link to leftclickblockevent

This event is fired when a player left clicks while targeting a block. This event controls which of Block#attack(BlockState, Level, BlockPos, Player) and/or the item harvesting methods will be called.

Note that if the event is canceled and the player holds down left mouse, the event will continue to fire. This is due to how vanilla calls the left click handler methods.

Also note that creative mode directly breaks the block without running any other logic.

The event is cancelable.

If the event is canceled, none of the above noted methods to be called.

The event does not have a result.

Diese Klasse importieren

Link to diese-klasse-importieren

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.entity.player.interact.LeftClickBlockEvent;

Extending PlayerInteractEvent

Link to extending-playerinteractevent

LeftClickBlockEvent extends PlayerInteractEvent. That means all methods available in PlayerInteractEvent are also available in LeftClickBlockEvent

Link to g-

Name: getUseBlock

Return Type: EventResult

ZenScript
Copy
// LeftClickBlockEvent.getUseBlock() as EventResult

myLeftClickBlockEvent.getUseBlock();

Link to g--1

Name: getUseItem

Return Type: EventResult

ZenScript
Copy
// LeftClickBlockEvent.getUseItem() as EventResult

myLeftClickBlockEvent.getUseItem();

Link to g--2

Name: setUseBlock

Return Type: void

ZenScript
Copy
LeftClickBlockEvent.setUseBlock(triggerBlock as EventResult) as void
ParameterTypeBeschreibung
Parameter
triggerBlock
Type
EventResult
Beschreibung
No Description Provided

Link to g--3

Name: setUseItem

Return Type: void

ZenScript
Copy
LeftClickBlockEvent.setUseItem(triggerItem as EventResult) as void
ParameterTypeBeschreibung
Parameter
triggerItem
Type
EventResult
Beschreibung
No Description Provided
NameTypeHas GetterHas SetterBeschreibung
Name
useBlock
Type
EventResult
Has Getter
true
Has Setter
true
Beschreibung
No Description Provided
Name
useItem
Type
EventResult
Has Getter
true
Has Setter
true
Beschreibung
No Description Provided