Both locations of a double chest

Discussion in 'Plugin Development' started by Barinade, Nov 4, 2014.

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

    Barinade

    I could just check the four sides for another chest block but I imagine there's an easier way to get it's location, anyone wanna clue me in?
     
  2. Offline

    mine-care

    Get block side south, north west ect and check if block is chest, if it is keep its location :p
     
  3. mine-care
    That's exactly what OP said himself.

    Barinade
    I doubt there's a better way. You can try cast the InventoryHolder of the Chest to DoubleChest, although this will never give you the locations of the sides so your best bet is to find the adjacent block.
     
  4. Offline

    mine-care

    Assist i understand but since he asked for the easyer solutin i sugested it :(
     
  5. mine-care
    Once again your suggestion is exactly the same as what he suggested. He was wanting to know if there is an easier solution than checking all the 4 sides.
     
  6. Offline

    Barinade

    ((Chest) doubleChest.getRightSide()).getLocation()
    ((Chest) doubleChest.getLeftSide()).getLocation()

    Anyone wanna tell me if they know this would work so I don't have to test it? :p
     
  7. Offline

    mine-care

    Assist as I said (but I wasn't clear) I wasn't aware of that so I sugestd it. Lets go back in topic now.
    Sorry Barinade.
     
  8. Offline

    Zupsub

    No that doesn't work: http://jd.bukkit.org/rb/apidocs/

    I'm not certain Minecraft itself stores the other chest part. Probably it get's searched when it's needed.
     
  9. Offline

    Barinade

    I constructed that example based on information found in the API docs.
     
Thread Status:
Not open for further replies.

Share This Page