Change block break time

Discussion in 'Plugin Development' started by ArthurHoeke, Aug 5, 2014.

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

    ArthurHoeke

    Hay,

    Is it possible to change how to it takes to break a specific block?
    So like that it takes 10 seconds to break a wooden door
    If its possible how can I do it?
     
  2. Offline

    xAstraah

    It's possible to do, but only with NMS code (meaning it's not a bukkit API, but in the vanilla minecraft code). If you want to change it, simply do this:
    Code:java
    1. Method method=net.minecraft.server.Block.class.getDeclaredMethod("c", float.class);
    2. method.setAccessible(true);
    3. method.invoke(net.minecraft.server.Block.BED, 50.0F);
    4.  

    This would make beds be the same hardness as obsidian. Just keep in mind that every time you update, you have to change "c" to whatever the obfuscated name is.

    Alternatively, you could do this:
    Code:java
    1. Field field=net.minecraft.server.Block.class.getDeclaredField("strength");
    2. field.setAccessible(true);
    3. field.setFloat(net.minecraft.server.Block.BED, 50.0F);
    4.  

    This wouldn't require updating

    CREDITS:
    bleachisback - Full credit
    xAstraah - I take no credit for this.
     
Thread Status:
Not open for further replies.

Share This Page