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
ConstructorsConstructorDescriptionEntityItemMergeEvent(@NotNull ItemEntity source, @NotNull ItemEntity merged, @NotNull ItemStack result) -
Method Summary
Modifier and TypeMethodDescription@NotNull ItemEntityGets theItemEntitywho is receivinggetMerged().@NotNull ItemEntityGets the entity who will be merged.@NotNull ItemStackGets the final item stack on the ground.booleanGets if theEventshould be cancelled or not.voidsetCancelled(boolean cancel) Marks theEventas cancelled or not.voidChanges 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, waitMethods 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 theItemEntitywho is receivinggetMerged().This can be used to get the final ItemEntity position.
- Specified by:
getEntityin 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:CancellableEventGets if theEventshould be cancelled or not.- Specified by:
isCancelledin interfaceCancellableEvent- Returns:
- true if the event should be cancelled
-
setCancelled
public void setCancelled(boolean cancel) Description copied from interface:CancellableEventMarks theEventas cancelled or not.- Specified by:
setCancelledin interfaceCancellableEvent- Parameters:
cancel- true if the event should be cancelled, false otherwise
-