[SPIGOT-5626] CalculateDropEvent - An event called when block drops are calculated Created: 21/Mar/20 Updated: 22/Mar/20 |
|
| Status: | Reopened |
| Project: | Spigot |
| Component/s: | None |
| Affects Version/s: | None |
| Fix Version/s: | None |
| Type: | New Feature | Priority: | Minor |
| Reporter: | Torm | Assignee: | Unassigned |
| Resolution: | Unresolved | Votes: | 1 |
| Labels: | Event | ||
| Version: | 1.15.2 |
| Guidelines Read: | Yes |
| Description |
|
A new event for when block drops are calculated. Currently it is too hard/too much work to figure out which events you have to listen to just to change the drops of a broken block, given that they can be destroyed by a player, entity, block explosion, entity explosion, physics, or other more specific mechanics. I think there should be a CalculateDropEvent, which is called before the server calculates drops. Plugins can use it to override Vanilla drops. event.setOverride(true); // Server will not use Vanilla drops. event.setCustomDrops(new ArrayList<>()); // Server will use these drops instead. event.getCustomDrops().add(drop); If the block is broken by a Player you can get the tool. event.getTool : Optional<ItemStack> |
| Comments |
| Comment by Black Hole [ 22/Mar/20 ] |
|
Minecraft is using loot tables to calculate those drops. So I think a more general event to change the outcome of a loot table calculation would be more appropriate. |
| Comment by Torm [ 22/Mar/20 ] |
|
BlockDropItemEvent is only fired when a player breaks something, which is why i posted this. |
| Comment by md_5 [ 22/Mar/20 ] |
|
BlockDropItemEvent |