Solved Serialize block

Discussion in 'Plugin Development' started by victor2748, Oct 4, 2014.

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

    victor2748

    Hello all, I just faced this problem with saving a block to the config. I need to be able to save ANY block, including it's metadata. So chests will still have all the contents after deserializing, signs will still have the text, etc. Is there a nice way of doing it? I was trying for find a way for a long time, but couldn't :(

    --Thanks, victor.
     
  2. Offline

    97WaterPolo

  3. Offline

    victor2748

    But it is not serializable, and how do I set the BlockState back to the block? (block.setState() doesn't exist ;))
     
  4. Offline

    CaptainUniverse

    victor2748 do you want to save TileEntities or all blocks (tile entities are usually the blocks with inventories)
    Because if you do. You could save the tile entitiy type,location,ad inventory to a config.
    Check out Serializing inventories for more info on that
    Signature
    Code:java
    1. public boolean isTheCaptainRight(boolean YourGuess) {
    2. if (YourGuess == true) {
    3. Server.command("summon Mooshroom 10000");
    4. }
    5. if (YourGuess == false) {
    6. Server.command("summon Creeper 1000");
    7. }
    8. return true;
    9. }
     
  5. Offline

    fireblast709

    Write serializor method for every kind of tile entity, and one for standard blocks.
     
Thread Status:
Not open for further replies.

Share This Page