Spout Faster Block Breaking

Discussion in 'Plugin Development' started by Ezzy, Mar 21, 2012.

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

    Ezzy

    Hi Guys!
    I do know that spout CAN make blocks break faster with:

    Code:
    public void onBlockDamage(BlockDamageEvent event){
            if(event.getBlock().getType().equals(Material.SANDSTONE)){
                float blockDirt = MaterialData.getBlock(2).getHardness();
                MaterialData.getBlock(24).setHardness(blockDirt);
            }
        }
    However, from what I can tell that set the hardness of ALL sandstone blocks on the server.
    Is there a way to set the hardness of a specific block?
     
  2. Offline

    dsmyth1915

    Maybe check the location of block being clicked, then setting that blocks hardness after that goes through.
     
  3. Offline

    Father Of Time

    Something like this should work.

    Code:
        public void onBlockDamage(BlockDamageEvent event)
        {
            Block eventblock = event.getBlock();
            if( eventblock.getType().equals(Material.SANDSTONE) && eventblock.getLocation().equals( YOURBLOCK.getLocation() ) )
            {
                        float blockDirt = MaterialData.getBlock(2).getHardness();
                        MaterialData.getBlock(24).setHardness(blockDirt);
            }
            }
    Code:
    eventblock.getLocation().equals( YOURBLOCK.getLocation() ) 
    YOURBLOCK is the block you want to verify is being broken, if the event block doesn't equal the specific block you stated then it won't break faster.

    Hope this helps.
     
  4. Offline

    bleachisback

    That still sets the hardness of all sandstone, but only when they break a certain block. As stated here, you can't do this, sorry.
     
  5. Offline

    Ezzy

    Ok, thank you guys anyway!
     
Thread Status:
Not open for further replies.

Share This Page