[SPIGOT-7468] BlockDispenseEvent should have getEntity() and getBlockState() method Created: 27/Aug/23 Updated: 25/Dec/24 |
|
Status: | Open |
Project: | Spigot |
Component/s: | None |
Affects Version/s: | None |
Fix Version/s: | None |
Type: | New Feature | Priority: | Minor |
Reporter: | mfnalex | Assignee: | Unassigned |
Resolution: | Unresolved | Votes: | 2 |
Labels: | None |
Version: | - |
Guidelines Read: | Yes |
Description |
BlockDispenseEvent only has a method to get the ItemStack that caused this event, but no method to get the "resulting" Entity spawned, which could be an Item, or e.g. a Boat/Minecart, or even a BlockState (e.g. when water is placed).
Is there any reason why this currently does not exist? I've seen a lot of "DispenseBehavior" classes in NMS. I think it'd be nice if they could somehow be exposed to the API, e.g. through two methods being added to BlockDispenseEvent:
/** * Gets the entity spawned through this BlockDispenseEvent, or null if there is none */ public @Nullable Entity getEntity(); /** * Gets the BlockState that will be created/changed through this BlockDispenseEvent, or null if there is none */ public @Nullable BlockState getNewBlockState(); Any opinions on this?
EDIT: lynx just reminded me, that the ItemStack being dispensed is changeable, so obviously it's not possible to get the resulting Entity/BlockState in this event yet, however there could maybe a separate BlockDispensedEvent, maybe split up into BlockDispensedEntityEvent and BlockDispensedBlockEvent, that could be used to get the result instead. |