Open AechtRob opened 3 years ago
Maybe. It's not pretty, but something like this might work... for vanilla blocks at least. This may break down if a large number of blocks dropped at the same time, ie. a large-scale player orchestrated sand drop. I don't really see another way to do it though. I'm leaving these notes here for future me if I ever do it.
Use the EntityJoinWorldEvent
to determine when an instance of EntityFallingBlock
joins the world, and:
IBlockState
from the falling entity.ORIGIN
data parameter from the falling entity.ORIGIN
data parameter to retrieve the falling entity's origin BlockPos
.EntityFallingBlock
uses to determine the block's drops and place them in a list.BlockPos
and IBlockState
to Dropt's rule locator.captureDrops
flag to true and cache the falling entity, the falling entity's BlockPos
, the rule, and the falling entity's capturedDrops
list.Each server tick, iterate the falling entity cache, and:
capturedDrops
list is not empty, the falling entity has broken
BlockPos
, rule, and capturedDrops
list to Dropt's drop modifierIn my simplistic way, I was wondering if it was at least possible to selectively block/replace certain drops from certain falling block entities….. Eg. create some sort of extension to the existing gamerule doEntityDrops and allow it to be set on an entity-specific level (very like how this other mod allows the doMobGriefing rule to be set on a mob-specific level: https://www.curseforge.com/minecraft/mc-mods/better-mobgriefing-gamerule).
(So rather than wait for a drop to spawn in the world and then work out what to do with it retrospectively, prevent or change that item before it spawns).
It looks like dropt doesn't change the drops which happen when a falling block hits a half slab or similar. Is it possible to enhance the mod so that for any (modded or vanilla) block it also checks if there is an associated falling entity with its own drops, and amends them too?