Package net.minestom.server.event.entity
Class EntityItemMergeEvent
java.lang.Object
net.minestom.server.event.entity.EntityItemMergeEvent
- All Implemented Interfaces:
Event
,CancellableEvent
,EntityEvent
,EntityInstanceEvent
,InstanceEvent
Called when two
ItemEntity
are merging their ItemStack
together to form a sole entity.-
Constructor Summary
ConstructorDescriptionEntityItemMergeEvent
(@NotNull ItemEntity source, @NotNull ItemEntity merged, @NotNull ItemStack result) -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemEntity
Gets theItemEntity
who is receivinggetMerged()
.@NotNull ItemEntity
Gets the entity who will be merged.@NotNull ItemStack
Gets the final item stack on the ground.boolean
Gets if theEvent
should be cancelled or not.void
setCancelled
(boolean cancel) Marks theEvent
as cancelled or not.void
Changes the item stack which will appear on the ground.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods inherited from interface net.minestom.server.event.trait.EntityInstanceEvent
getInstance
-
Constructor Details
-
EntityItemMergeEvent
public EntityItemMergeEvent(@NotNull @NotNull ItemEntity source, @NotNull @NotNull ItemEntity merged, @NotNull @NotNull ItemStack result)
-
-
Method Details
-
getEntity
Gets theItemEntity
who is receivinggetMerged()
.This can be used to get the final ItemEntity position.
- Specified by:
getEntity
in interfaceEntityEvent
- Returns:
- the source ItemEntity
-
getMerged
Gets the entity who will be merged.This entity will be removed after the event.
- Returns:
- the merged ItemEntity
-
getResult
Gets the final item stack on the ground.- Returns:
- the item stack
-
setResult
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 theEvent
should be cancelled or not.- Specified by:
isCancelled
in interfaceCancellableEvent
- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEvent
Marks theEvent
as cancelled or not.- Specified by:
setCancelled
in interfaceCancellableEvent
- Parameters:
cancel
- true if the event should be cancelled, false otherwise
-