FallenMoonNetwork / CanaryMod

Server administration mod and API for Minecraft beta multiplayer server
http://canarymod.net
GNU Lesser General Public License v3.0
20 stars 14 forks source link

onExplosion(Block, BaseEntity, List): BaseEntity is null for Ghast fireballs #142

Closed nosefish closed 11 years ago

nosefish commented 11 years ago

The onExplosion hook is called with a null BaseEntity on Ghast fireball explosions; Creepers, TNT, and Wither work as expected.

14mRh4X0r commented 11 years ago

What would you think is appropriate to pass as the entity, the Ghast or its fireball? I'm thinking fireball, probably, because it may be possible to get the shooting Entity from it.

14mRh4X0r commented 11 years ago

Actually, this would be a vanilla "bug". The OExplosion is being created with null as the causing entity, when an OEntityLargeFireball hits. I'm in the process of finding out whether it would cause unintended side-effects if I'd pass the entity, otherwise I'll be adding that. Above question still remains in that case. In any case, it's still possible to get the Ghast from onProjectileHit. This requires an entity to be hit though.

14mRh4X0r commented 11 years ago

This cannot be added without rewriting major parts of our code. If anyone feels up to it, feel free to submit a pull request when finished, but for now this will not get fixed. You can check for null and even (possibly) get the entity from the block coordinates if needed.

nosefish commented 11 years ago

I should probably use block.Status to get the cause of the explosion anyway. I used entity.getName() as a workaround for the block.Status() documentation issue #143. It makes sense that there is no entity passed here, because the fireball gets destroyed in the explosion.