Enhanced AI

Enhanced AI

7M Downloads

[Suggestion] Please use the value returned by Level.destroyBlock

thexaero opened this issue ยท 5 comments

commented

The returned boolean tells you if destroying the block succeeds.
This is related to issue #142. The LivingDestroyBlockEvent is spammed like crazy, even with no mods, for blocks most of which aren't even the ones being broken. Checking claim permissions every time it's fired doesn't seem like a good idea to me. The event name is pretty misleading tbh.

commented

Use the value to do what?

commented

Not drop resources if destroying a block doesn't succeed, fixing the dupe.

commented

Thanks so much for the fix!
I see that you also changed how you use the event. To clarify, I meant that the event is spammed even without your mod, for vanilla mobs. It's unusable by default, not because of how you used it specifically.

commented

In vanilla it's called only by the dragon, the wither and zombies breaking doors

commented

For zombies destroying turtle eggs too. The problem is that it's called from RemoveBlockGoal.isValidTarget which is called for every checked position in findNearestBlock(), not just the actual target block. The event is fired before even the blockstate is checked to be the right one. I don't know if this is useful for something that I'm not aware of, but certainly not good for claim permission checks.