Solved Getting doublechest instance

Discussion in 'Plugin Development' started by Hex_27, Oct 9, 2015.

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

    Hex_27

    I need to get a doublechest instance. I've tried casting from chest to doublechest, but it didn't work. How can I get the double chest instance from a chest blockstate?
    Either this, or I need the 2 locations of the double chest. I would want to refrain from looping all the surrounding blocks.
     
    Last edited: Oct 9, 2015
  2. Offline

    RoboticPlayer

    What exaclty are you trying to do?
     
  3. Offline

    Hex_27

    @henderry2019 I need to check if there's a wall sign on the chest

    nevermind, figured it out

    EDIT by Moderator: merged posts, please use the edit button instead of double posting.
     
    Last edited by a moderator: Oct 29, 2015
  4. Offline

    Langsdorf

    Maybe i help you

    nevermind <.<

    Code:
    @EventHandler
        public void a(BlockPlaceEvent e) {
            Location l = e.getBlockAgainst().getLocation();
            Location l1 = l.add(1, 0, 1);
            Location l2 = l.add(-1, 0, -1);
            if (l.getBlock().getType() == Material.CHEST) {
                if (l1.getBlock().getType() == Material.CHEST || l2.getBlock().getType() == Material.CHEST) {
                    //do stuff
                }
            }
        }
     
Thread Status:
Not open for further replies.

Share This Page