Block states?

Discussion in 'Plugin Development' started by 6SidedPentagon, Sep 16, 2012.

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

    6SidedPentagon

    Hi, im making a plugin that resets maps, im using a hashmap and locations and integers to restore the block at the location to the id already saved. This works well until it gets to blocks such as pistons and tripwire hooks, these all spawn in crazy ways. I think i have to use the blockstate, i can save the blockstate but how do i restore to this state when saved? (sorry i dont want to use world edit).
     
  2. Offline

    LimitedWard

    You might need to store the block's damage value. I believe that for many blocks like pistons and stairs, the damage value indicates which direction the block should face.
     
  3. Offline

    6SidedPentagon

    how would i do this?, theres no getDamageValue() in block
     
  4. Offline

    gregthegeek

    Try block.getData();
     
  5. Offline

    6SidedPentagon

    ok i got this working using the update method for a block state. My problem now is how to save the contents of a chest and restore it?
     
  6. Offline

    gregthegeek

    You're going to have to change your HashMap to something that would support this. I would recommend making a class that represents a block without a location, or using block.getSnapshot().
     
  7. Offline

    6SidedPentagon

    what is block.getSnapshot() and can this be restored?
     
Thread Status:
Not open for further replies.

Share This Page