Use WorldSavedData to store NBT information per-world (or per-dimension, depending on your needs).
The readthedocs explain WorldSavedDatahere, and I have a (large) example here. Remember to call markDirty() any time you change a value that you want saved.
Another way to do this would be writing a file to the world save folder, but trust me -- WorldSavedData is easier and more reliable.
Rollback Post to RevisionRollBack
Click this banner for a list of illegal mod distributors -- only download from legal sites!
I need to make something happen only once in a world. Being generate a structure, start an event, etc.
Is there a good tutorial on how to store a value and change that value for a world?
I would assume that I need to be using NBT data, but have no idea where to start.
I understand how to add an NBT value to a player.
How do I create NBT data for a world?
Is that the best way to accomplish what I aim to do?
Thanks for any help you can offer!
Use WorldSavedData to store NBT information per-world (or per-dimension, depending on your needs).
The readthedocs explain WorldSavedData here, and I have a (large) example here. Remember to call markDirty() any time you change a value that you want saved.
Another way to do this would be writing a file to the world save folder, but trust me -- WorldSavedData is easier and more reliable.
Thank you! I have got it working beautifully!