Insane96 / EnhancedAI

Creepers Breaching, Zombies Mining and Skeleton Sniping
https://www.curseforge.com/minecraft/mc-mods/enhanced-ai
20 stars 6 forks source link

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

Closed thexaero closed 7 months ago

thexaero commented 7 months ago

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.

Insane96 commented 7 months ago

Use the value to do what?

thexaero commented 7 months ago

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

thexaero commented 7 months ago

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.

Insane96 commented 7 months ago

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

thexaero commented 7 months ago

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.