Contents
Class PlaceBlockEvent
java.lang.Object
com.hypixel.hytale.component.system.EcsEvent
com.hypixel.hytale.component.system.CancellableEcsEvent
com.hypixel.hytale.server.core.event.events.ecs.PlaceBlockEvent
- All Implemented Interfaces:
ICancellableEcsEvent
An event that is called when a block is placed in the world.
If cancelled, the block will not be placed.
-
Constructor Summary
ConstructorsConstructorDescriptionPlaceBlockEvent(ItemStack itemInHand, org.joml.Vector3i targetBlock, RotationTuple rotation) Default Constructor for aPlaceBlockEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionorg.joml.Vector3ibooleanvoidsetConsumeItem(boolean consumeItem) Called to set whether placing the block should consume it from the placer's inventory.voidsetRotation(RotationTuple rotation) Called to set the rotation of the placed block.voidsetTargetBlock(org.joml.Vector3i targetBlock) Called to set the position in which the block is being placed.Methods inherited from class CancellableEcsEvent
isCancelled, setCancelled
-
Constructor Details
-
PlaceBlockEvent
public PlaceBlockEvent(@Nullable ItemStack itemInHand, @Nonnull org.joml.Vector3i targetBlock, @Nonnull RotationTuple rotation) Default Constructor for aPlaceBlockEventinstance.- Parameters:
itemInHand- The item in the instigating entities hand, if any.targetBlock- The position in which the block is being placed.rotation- The rotation of the placed block.
-
-
Method Details
-
getItemInHand
- Returns:
- the item in the instigating entities hand, or
nullif none.
-
getTargetBlock
@Nonnull public org.joml.Vector3i getTargetBlock()- Returns:
- the position in which the block is being placed.
-
setTargetBlock
public void setTargetBlock(@Nonnull org.joml.Vector3i targetBlock) Called to set the position in which the block is being placed.- Parameters:
targetBlock- The new target block position.
-
getRotation
- Returns:
- the rotation of the placed block.
-
setRotation
Called to set the rotation of the placed block.- Parameters:
rotation- The new rotation.
-
isConsumeItem
public boolean isConsumeItem()- Returns:
- whether placing the block should consume it from the placer's inventory.
-
setConsumeItem
public void setConsumeItem(boolean consumeItem) Called to set whether placing the block should consume it from the placer's inventory.- Parameters:
consumeItem-falseto place the block without consuming it.
-