ExplosionPhysics
When a TNT block or other explosive goes off, it will turn all blocks into falling blocks, and then shoot them off with a vector away from the source explosion. All drops are cancelled. Have fun! All it does, is convert the blocks that n explosion would normally destroy into FallingBlock entities. It then shoots those entities off in different directions. Also it will not run the method if the event is cancelled (in the case of worldguard cancelling explosive block damage)
/* * To change this template, choose Tools | Templates * and open the template in the editor. */ package explosionphysics; import java.util.ArrayList; import org.bukkit.Bukkit; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; import org.bukkit.block.Block; import org.bukkit.entity.FallingBlock; import org.bukkit.event.Event; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.Listener; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; /** * * @author Taylor */ public class ExplosionPhysics extends JavaPlugin implements Listener{ public ArrayList<Material> disallowedBlocks = new ArrayList<Material>(); @Override public void onEnable(){ getServer().getPluginManager().registerEvents(new ExplosionPhysics(), this); disallowedBlocks.clear(); disallowedBlocks.add(Material.TNT); disallowedBlocks.add(Material.PISTON_BASE); disallowedBlocks.add(Material.PISTON_EXTENSION); disallowedBlocks.add(Material.PISTON_MOVING_PIECE); disallowedBlocks.add(Material.PISTON_STICKY_BASE); } @EventHandler(priority = EventPriority.NORMAL) public void onBlockExplode(org.bukkit.event.entity.EntityExplodeEvent e){ if (e.isCancelled()){return;} if (e.blockList().isEmpty()){return;} e.setYield(0F); double x = 0; double y = 0; double z = 0; Location eLoc = e.getLocation(); World w = eLoc.getWorld(); for (int i = 0; i < e.blockList().size();i++){ Block b = e.blockList().get(i); Location bLoc =b.getLocation(); if (disallowedBlocks.contains(b.getType())){continue;} x = bLoc.getX() - eLoc.getX(); y = bLoc.getY() - eLoc.getY() + .5; z = bLoc.getZ() - eLoc.getZ(); FallingBlock fb = w.spawnFallingBlock(bLoc, b.getType(), (byte)b.getData()); fb.setDropItem(false); fb.setVelocity(new Vector(x,y,z)); } } }
does not work on 1.7.2+
@Pangamma
Hi, can you please update it for CraftBukkit 1.7.2-R0.3 ? I tried it on my own but I can not make it.
@catprowler
Should be safe to use. WorldGuard should have higher priority.
Hi there, If I have worldguard on my server and I put a region flag to not break certain blocks would this plugin override it? Thank you. :)
@nullschritt
Alright, Alright. I'll add the config option this week.
I actually like it not making the blocks disappear better. It makes explosions messy, like they should be. Not perfectly neat.
@AljedTheLegit
So I take it no chance of a config option to remove blocks after they land?
This plugin would have been useful if it just removed the blocks a bit but this sucks :/.
Thought it would be useful for raiding like they destroy a base and then roll it back so the landscape is not fked.
@jadyha
That's the whole point, lol.
I thought I would love this plugin! And I do! But it's horrible that 10 TNT Will trash a land that are over 100 blocks away. Witch is why I will not keep this plugin installed untill something is done about this. It makes the terrain look HORRIBLE!
@CommodoreAlpha
I agree. I once set a mountain to TNT (ignited it with lots of lag) and after that it looked like it has been raining dirt and stone. xD I guess it should be dropping those blocks or keep them as an entity which disappears after a while, or just vanish them.
This seems to be a really unique plugin that adds a new spin to explosions, which I (and other players) absolutely love. However, I do have a request...
Could you make it so that when the blocks get flown off and land on something, they don't become blocks and simply disappear? This is because, while the flying blocks are fun to watch, the landscape becomes extremely dirty after 100 TNT in a row. You could probably make this a configurable option.
Also, when the blocks that would normally get destroyed convert to entities, does the block still technically get destroyed from the explosion itself, or does the plugin intercept the explosion damage and convert it to an entity with momentum?
This is because the plugin, combined with the above feature and the plugin CreeperHeal, would be awesome to have around (for making TNT more realistic and more visible) without worry of a ruined landscape.
Oh good fun!!
Think it might be cool if the blocks that would usually get destroyed still get destroyed, only the blocks surrounding those become falling blocks and scatter around. It would make TNT more destructive, but that would be a cool option to have =]
@lukecfairchild
nah it doesn't. All it does is take the blocks an explosion is already going to destroy, and turns them into flyingblock entities. Then shoots them off. Since bedrock and obsidian don't pop off they wouldn't be affected.
I saw another plugin like this but it would move obsidian and bedrock. Does this one?
@UltiByte
Thank you! =D
Looks pretty epic! I'll install your plugin for my raid world. ;D
Wow. You seem to have a real knack at making really useful, high quality plugins. :)
Wow. You seem to have a real knack at making really useful, high quality plugins. :)