Class DamageBlockEvent

java.lang.Object
fr.hytale.loader.event.types.ecs.DamageBlockEvent
All Implemented Interfaces:
com.hypixel.hytale.event.IBaseEvent<Void>, com.hypixel.hytale.event.IEvent<Void>

public class DamageBlockEvent extends Object implements com.hypixel.hytale.event.IEvent<Void>
Called when a block takes damage.

This event is fired when a block is being damaged but not yet broken. This allows mods to track block damage progression or modify damage values. The event can be cancelled to prevent damage.

Since:
1.0.1
Version:
1.0.4
Author:
HytaleLoader
  • Constructor Summary

    Constructors
    Constructor
    Description
    DamageBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.DamageBlockEvent originalEvent, Player player)
    Constructs a new DamageBlockEvent.
  • Method Summary

    Modifier and Type
    Method
    Description
    com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType
    Gets the type of block being damaged.
    float
    Gets the current accumulated damage on the block.
    float
    Gets the damage being applied in this event.
    com.hypixel.hytale.server.core.inventory.ItemStack
    Gets the item being used to damage the block.
    Gets the player who damaged the block.
    com.hypixel.hytale.math.vector.Vector3i
    Gets the position of the block being damaged.
    boolean
    Checks if this event has been cancelled.
    void
    setCancelled(boolean cancelled)
    Sets the cancelled state of this event.
    void
    setDamage(float damage)
    Sets the damage to be applied.
    void
    setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock)
    Sets the target block position.

    Methods inherited from class Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • DamageBlockEvent

      public DamageBlockEvent(com.hypixel.hytale.server.core.event.events.ecs.DamageBlockEvent originalEvent, Player player)
      Constructs a new DamageBlockEvent.
      Parameters:
      originalEvent - the original Hytale ECS event
      player - the player who damaged the block, or null if not a player
  • Method Details

    • getItemInHand

      public com.hypixel.hytale.server.core.inventory.ItemStack getItemInHand()
      Gets the item being used to damage the block.
      Returns:
      the item in hand, or null if no item
    • getTargetBlock

      public com.hypixel.hytale.math.vector.Vector3i getTargetBlock()
      Gets the position of the block being damaged.
      Returns:
      the block position
    • setTargetBlock

      public void setTargetBlock(com.hypixel.hytale.math.vector.Vector3i targetBlock)
      Sets the target block position.
      Parameters:
      targetBlock - the new target position
    • getBlockType

      public com.hypixel.hytale.server.core.asset.type.blocktype.config.BlockType getBlockType()
      Gets the type of block being damaged.
      Returns:
      the block type
    • getCurrentDamage

      public float getCurrentDamage()
      Gets the current accumulated damage on the block.
      Returns:
      the current damage value
    • getDamage

      public float getDamage()
      Gets the damage being applied in this event.
      Returns:
      the damage amount
    • setDamage

      public void setDamage(float damage)
      Sets the damage to be applied.
      Parameters:
      damage - the new damage amount
    • isCancelled

      public boolean isCancelled()
      Checks if this event has been cancelled.
      Returns:
      true if cancelled, false otherwise
    • setCancelled

      public void setCancelled(boolean cancelled)
      Sets the cancelled state of this event.
      Parameters:
      cancelled - true to cancel, false to allow
    • getPlayer

      public Player getPlayer()
      Gets the player who damaged the block.
      Returns:
      the player, or null if the block was not damaged by a player