How to get/remove/change drop in DropItemEvent.Destruct Event?
I think you should be able to modify the List, returned by evt.getEntities()
directly. So, evt.getEntities().clear()
would remove all drops … i didn’t test it though.
1 Like
Clear - work
Add/remove - ?
If clear is working any modification on this list is working
1 Like
I know, how to i can create a new item and add to drop?
@Listener
public void onDropItem(DropItemEvent.Destruct event){
-
-
-
- event.getEntities().clear();
-
-
-
-
-
- Item item = (Item)event.getTargetWorld().createEntity(EntityTypes.ITEM, new Vector3d()).get();
-
-
-
-
-
- event.getEntities().add(item);
}
Not work
- event.getEntities().add(item);
-
-
You can only add items from the list. To drop additional items, you’ll need to do it outside of the event.