LeftClickBlockEvent
Importing the class
If you need to reference this type directly, like when casting an Array, or as a parameter, you will need to import it. Simply add the import at the top of the file.
import crafttweaker.neoforge.api.event.interact.LeftClickBlockEvent;
Description
This event is fired when a player left clicks while targeting a block. This event controls which of 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.
canceled none of the above noted methods to be called.
Extends
LeftClickBlockEvent extends PlayerInteractEvent
.
Implements
LeftClickBlockEvent
implements the following interfaces:
Listening to the event
This event can be listened to like so:
events.register<crafttweaker.neoforge.api.event.interact.LeftClickBlockEvent>(event => { println("LeftClickBlockEvent ran!");});
Members
cancel()
Cancels the event. Same as script.zs
setCanceled(true)
// LeftClickBlock.cancel();event.cancel();
Getter
// LeftClickBlock.canceled as boolevent.canceled
Return Type:
bool
Setter
// LeftClickBlock.canceled = (cancel as bool);event.canceled = myBool;
Parameters:
cancel: bool
Type: bool
canceled() as bool
// LeftClickBlock.canceled() as bool;event.canceled();
Return Type:
bool
canceled(cancel as bool)
// LeftClickBlock.canceled(cancel as bool);event.canceled(myBool);
Parameters:
cancel: bool
Type: bool
Getter
Getter
// LeftClickBlock.entity as LivingEntityevent.entity
Return Type:
LivingEntity
Getter
Getter
// LeftClickBlock.hand as InteractionHandevent.hand
Return Type:
InteractionHand
Getter
// LeftClickBlock.hasResult as boolevent.hasResult
Return Type:
bool
hasResult() as bool
// LeftClickBlock.hasResult() as bool;event.hasResult();
Return Type:
bool
Getter
The stack involved in this interaction. May be empty, but will never be null.script.zs
// LeftClickBlock.itemStack as IItemStackevent.itemStack
Return Type:
IItemStack
Getter
// LeftClickBlock.result as EventResultevent.result
Return Type:
EventResult
Setter
event.result = myResult;
Parameters:
result: EventResult
Type: EventResult
result() as Result
result(result as Result)
event.result(myResult);
Parameters:
result: EventResult
Type: EventResult
setAllow()
sets the event's result to script.zs
allow
// LeftClickBlock.setAllow();event.setAllow();
setDefault()
sets the event's result to script.zs
default
// LeftClickBlock.setDefault();event.setDefault();
setDeny()
sets the event's result to script.zs
deny
// LeftClickBlock.setDeny();event.setDeny();
Getter
// LeftClickBlock.useBlock as EventResultevent.useBlock
Return Type:
EventResult
Setter
event.useBlock = myResult;
Parameters:
triggerBlock: EventResult
Type: EventResult
Getter
// LeftClickBlock.useItem as EventResultevent.useItem
Return Type:
EventResult
Setter
event.useItem = myResult;
Parameters:
triggerItem: EventResult
Type: EventResult