Problem with Block Faces. Possibly a bug.

Discussion in 'Plugin Development' started by Danelli, Dec 22, 2013.

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


    Very strange problem. It seems when I try to naturally break the blocks surrounding a log block or leave block, an error occurs. By removing the opposite face though, it actually does work. For example if the two recursion lines for North, the South actually works. Same with East and West. I have no idea why this is. Should I report it as a bug?
    1. public static void LogsToDrop(Block base) {
    2. if (base.getType() != Material.LOG && base.getType() != Material.LEAVES) return;
    3. if (base.getRelative(BlockFace.NORTH).getType() == Material.LOG)
    4. LogsToDrop(base.getRelative(BlockFace.NORTH));
    5. if (base.getRelative(BlockFace.SOUTH).getType() == Material.LOG)
    6. LogsToDrop(base.getRelative(BlockFace.SOUTH));
    7. if (base.getRelative(BlockFace.EAST).getType() == Material.LOG)
    8. LogsToDrop(base.getRelative(BlockFace.EAST));
    9. if (base.getRelative(BlockFace.WEST).getType() == Material.LOG)
    10. LogsToDrop(base.getRelative(BlockFace.WEST));
    11. if (base.getType() == Material.LOG) {
    12. LogsToDrop(base.getRelative(BlockFace.UP));
    13. for (ItemStack items : base.getDrops())
    14. base.getWorld().dropItem(base.getLocation(), items);
    15. base.setType(Material.AIR);
    16. }
    17. }
Thread Status:
Not open for further replies.

Share This Page