Solved Persistent metadata for blocks

Discussion in 'Plugin Development' started by Dudemister1999, Nov 1, 2014.

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

    Dudemister1999

    Hello! I've got a quick question with a most likely long answer: I need to know how to make a block's metadata persistent. I've been looking around, and I've seen a lot of people ask, but not a lot of people answer. I was thinking NBT tags, but I can't think of a way to bind that to a block!

    Thanks!
    -Hydroxocobalamin (OCHbl)
     
  2. Offline

    TheCodingCat

    just save the metadata (or I should say what your PUTTING in the metadata) to a file (I'd say a YAML file :p)
     
  3. Offline

    Dudemister1999

    TheCodingCat Alright. I'm just trying to find a good way to store inventories. I've seen a lot of tutorials, but none of which (That I've seen) support Item metadata for inventory contents.
     
  4. Offline

    xTrollxDudex

    You can use fixed metadata, the documentation says that it is a constant value, however, the meaning of that is ambiguous. Give it a try.
     
  5. Offline

    Dudemister1999

    xTrollxDudex I'm currently using FixedMetadataValues, but they aren't persistent.

    Code:java
    1. block.setMetadata("dworks_name", new FixedMetadataValue(CustomItemsPlugin.instance, name));


    Then, I restart the server and check if the block has a dworks_name metadata. It does not.
     
  6. Offline

    xTrollxDudex

    Ah, that is unfortunate... You could just associate a particular item with the data yourself, as that could be put into a config...
     
  7. Offline

    Dudemister1999

Thread Status:
Not open for further replies.

Share This Page