Contents
Class DamageBlockEvent
java.lang.Object
com.hypixel.hytale.component.system.EcsEvent
com.hypixel.hytale.component.system.CancellableEcsEvent
com.hypixel.hytale.server.core.event.events.ecs.DamageBlockEvent
- All Implemented Interfaces:
ICancellableEcsEvent
An event that is called when a block is being damaged in the world.
If cancelled, damage will not be applied to the block.
-
Constructor Summary
ConstructorsConstructorDescriptionDamageBlockEvent(ItemStack itemInHand, org.joml.Vector3i targetBlock, BlockType blockType, float currentDamage, float damage) Default Constructor for aDamageBlockEventinstance. -
Method Summary
Modifier and TypeMethodDescriptionfloatfloatorg.joml.Vector3ivoidsetDamage(float damage) Called to set the amount of damage to apply to the block.voidsetTargetBlock(org.joml.Vector3i targetBlock) Called to set the position of the block being damaged.Methods inherited from class CancellableEcsEvent
isCancelled, setCancelled
-
Constructor Details
-
DamageBlockEvent
public DamageBlockEvent(@Nullable ItemStack itemInHand, @Nonnull org.joml.Vector3i targetBlock, @Nonnull BlockType blockType, float currentDamage, float damage) Default Constructor for aDamageBlockEventinstance.- Parameters:
itemInHand- The item in the instigating entities hand, if any.targetBlock- The position of the block being damaged.blockType- The type of block being damaged.currentDamage- The current damage on the block.damage- The amount of damage to apply to the 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 of the block being damaged.
-
setTargetBlock
public void setTargetBlock(@Nonnull org.joml.Vector3i targetBlock) Called to set the position of the block being damaged.- Parameters:
targetBlock- The new target block position.
-
getBlockType
- Returns:
- the type of block being damaged.
-
getCurrentDamage
public float getCurrentDamage()- Returns:
- the current damage on the block.
-
getDamage
public float getDamage()- Returns:
- the amount of damage to apply to the block.
-
setDamage
public void setDamage(float damage) Called to set the amount of damage to apply to the block.- Parameters:
damage- The new damage amount.
-