-
Type:
New Feature
-
Resolution: Unresolved
-
Priority:
Minor
-
None
-
Affects Version/s: None
-
None
-
-
-
Yes
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.