codetaylor / dropt-1.12

Flexible block drop strategies.
https://minecraft.curseforge.com/projects/dropt
Other
6 stars 2 forks source link

Hook into falling entity drops for BlockFalling classes #75

Open AechtRob opened 3 years ago

AechtRob commented 3 years ago

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?

codetaylor commented 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:

Each server tick, iterate the falling entity cache, and:

AechtRob commented 3 years ago

In 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).