weird bug with breakNaturally()

Discussion in 'Plugin Development' started by nicerman1, Mar 20, 2018.

Thread Status:
Not open for further replies.
  1. Hi, i'm making a auto shovel plugin and i want to mine a certain area and let the content drop as if it was mined. It works, except it doesn't work for snowlayer (minecraft id 78).
    This is (part of) code:
    Code:
    
    ItemStack ironShovel = new ItemStack(Material.IRON_SPADE, 1);
            Location location = block.getLocation();
    
            int LocX = location.getBlockX();
            int LocY = location.getBlockY();
            int LocZ = location.getBlockZ();
    
    for (int i = -1; i <= 1; i++) {
                    for (int k = 0; k <= 4; k++) {
                        Location LocationCheck = new Location(location.getWorld(), LocX + i, LocY, LocZ + k);
                        Block blockToBreak = LocationCheck.getBlock();
                        if (blockToBreak.getTypeId() == 2 || blockToBreak.getTypeId() == 3 || blockToBreak.getTypeId()== 12
                                || blockToBreak.getTypeId() == 13 || blockToBreak.getTypeId() == 88
                                || blockToBreak.getTypeId() == 82 || blockToBreak.getTypeId() == 78
                                || blockToBreak.getTypeId() == 80) {
                            blockToBreak.breakNaturally(ironShovel);
                        }
                    }
                }
    
    I assume this is a bug, because it does work on a "normal" snowblock (minecraft id 80) and drops snowballs which wouldn't work if it didn't "use" the shovel. Any ideas?
     
Thread Status:
Not open for further replies.

Share This Page