Class EntityItemMergeEvent

java.lang.Object
net.minestom.server.event.entity.EntityItemMergeEvent
All Implemented Interfaces:
Event, CancellableEvent, EntityEvent, EntityInstanceEvent, InstanceEvent

public class EntityItemMergeEvent extends Object implements EntityInstanceEvent, CancellableEvent
Called when two ItemEntity are merging their ItemStack together to form a sole entity.
  • Constructor Details

    • EntityItemMergeEvent

      public EntityItemMergeEvent(@NotNull @NotNull ItemEntity source, @NotNull @NotNull ItemEntity merged, @NotNull @NotNull ItemStack result)
  • Method Details

    • getEntity

      @NotNull public @NotNull ItemEntity getEntity()
      Gets the ItemEntity who is receiving getMerged().

      This can be used to get the final ItemEntity position.

      Specified by:
      getEntity in interface EntityEvent
      Returns:
      the source ItemEntity
    • getMerged

      @NotNull public @NotNull ItemEntity getMerged()
      Gets the entity who will be merged.

      This entity will be removed after the event.

      Returns:
      the merged ItemEntity
    • getResult

      @NotNull public @NotNull ItemStack getResult()
      Gets the final item stack on the ground.
      Returns:
      the item stack
    • setResult

      public void setResult(@NotNull @NotNull ItemStack result)
      Changes the item stack which will appear on the ground.
      Parameters:
      result - the new item stack
    • isCancelled

      public boolean isCancelled()
      Description copied from interface: CancellableEvent
      Gets if the Event should be cancelled or not.
      Specified by:
      isCancelled in interface CancellableEvent
      Returns:
      true if the event should be cancelled
    • setCancelled

      public void setCancelled(boolean cancel)
      Description copied from interface: CancellableEvent
      Marks the Event as cancelled or not.
      Specified by:
      setCancelled in interface CancellableEvent
      Parameters:
      cancel - true if the event should be cancelled, false otherwise