Changing Block Explosion Resistance

Discussion in 'Plugin Development' started by KeybordPiano459, Sep 4, 2012.

Thread Status:
Not open for further replies.
  1. Offline


    Is there a way to change the blast resistance of a block? For example instead of 18000 I could change bedrock blast resistance to 2 or something like that.


    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
    Last edited by a moderator: May 28, 2016
  2. Offline


    There are many ways of doing it. The simplest would be to just alter the durability field of the net.minecraft.server.Block class in question.

    I've made a simple prototype for doing this safely and efficiently. First, add the following BlockOverride class to a package:

    Then add this modified FieldUtils from Apache Commons to the same package. You'll now be able to modify the durability field like so:
    import net.minecraft.server.Block;
    public class ResistanceMod extends JavaPlugin  {
        // Modify obsidian!
        private BlockOverride obsidian = new BlockOverride(Block.OBSIDIAN);
        public void onLoad() {
            // Even less than wood
            obsidian.set("durability", 2.0f * 3);
        public void onDisable() {
    It's important to reset the values if the user disables the plugin. You shouldn't go about modifying internal Minecraft classes without cleaning up after yourself.

    The end result is something like this:

    If you need to customize the explosion algorithm in even more detail, you'd have to do something like FatTNT and replace the default algorithm altogether. But that shouldn't be necessary for simple things like setting the blast resistance.
    Xp10d3 likes this.
Thread Status:
Not open for further replies.

Share This Page