OtherDrops

226k Downloads

tool: EXPLOSION

Zarius opened this issue · 11 comments

commented

Change drops from exploded blocks (idea from cyklo's issues page)

Additional to this idea: (onEntityExplode)
EntityListener.onEntityExplode(EntityExplodeEvent event)
Useful for allow creepers to drop something after an explosion (diamonds, zombies, tree, etc)

commented

I thought there was a DAMAGE_EXPLOSION or something like that; would that cover this?

commented

Yeah, but I thought this only triggered why an entity was damaged by an explosion - not blocks. Could still use DAMAGE_EXPLOSION when extending to blocks but need a way to distinguish between a creeper being hit with an explosion and itself exploding.

commented

Ah yes, that's true; DAMAGE_* only applies to entities.

commented

Note for posterity... it's EXPLOSION@, where is TNT, FIRE[BALL], or CREEPER (or some other creature). Also I think there's ANY_EXPLOSION. Not sure how well it works, though you've been testing it, right?

commented

Well, I thought testing this was how you'd exposed the danger of recursive explosions. <_<

commented

Haven't tested this yet, no - will add it to my list :)

commented

Nope - my test was with events:

GRASS:
- tool: ANY
event: EXPLOSION
chance: 5%
- drop: DIAMOND

Makes quite a nice sized hole in the ground without overloading the server too much :D 100% destroys every connected grass block within the currently connected & loaded chunks and lags the server to death :)

With the improved fix in 985e2e4 allows the first explosion as there is an entity (tntprimed) whereas subsequent explosions use world.createExplosion and have no entity.

I'll test out tool: EXPLOSION soon as I'm sure there's cool stuff to be done with it too.

commented

Oh, I see, you had tool ANY so explosions also matched that.

Your improved fix still isn't perfect (I added a comment in the source). Personally I think the flag-based method for temporarily disabling explosion drops is better, though possibly not quite as naïvely as I initially implemented it.

commented

Noting Celtics comment for future reference: 7d8e989#L14R139

commented

Again not perfect but should work for the vast majority of cases:

With the "power" of an explosion being a float we could perhaps add a "signature" to the end - ie. power = power + 0.0000000000789897 (or whatever the precision of a float allows on all systems) - when we create the explosion and then check those bits in the explosion event.

The best way would be for bukkit itself to allow a tag to be added to explosions so that you can later identify which plugin/event created them (automatically including the plugin name that initiated the explosion would be great).

commented

That's an interesting idea. I'm not sure if it would work, but it's an interesting idea.