I cannot figure out how to write NBT tags to a world. Specifically, write all the data in an ArrayList to an NBT tag but not on any item just the world. Any help would be appreciated!
Ok, so I understand how to create and save the NBT Tags but there is one method that confuses me, the updateTagCompound method. What calls updateTagCompound? Do I have to call it manually or create an event handler. Also I know how to register each item in the arraylist on the nbt tag but not set the values back again on the nbt tag for an arraylist.
Also just to make sure would this work I am not 100% positive because I do not know where to call updateTagCompound and also just to make sure I call readInTagCompound at preInit?
public void readInTagCompound(){
for(int i = 0; i < gasses.size(); i++){
Gas gas = gasses.get(i);
String name = gas.getName();
float amountInAtmosphere = gassesNBT.getFloat(name);
gasses.get(i).setAmount(amountInAtmosphere);
}
}
public void updateTagCompound(){
for(int i = 0; i < gasses.size(); i++){
Gas gas = gasses.get(i);
String gasName = gas.getName();
float amountInAtmosphere = gas.getAmount();
I cannot figure out how to write NBT tags to a world. Specifically, write all the data in an ArrayList to an NBT tag but not on any item just the world. Any help would be appreciated!
Look at the world info. World#getWorldInfo() and then there are ways to update the world nbt tags.
If you would like to get a hold of me somehow, then my discord is @Alex Couch#5275.
Alright, I will look into it!
Ok, so I understand how to create and save the NBT Tags but there is one method that confuses me, the updateTagCompound method. What calls updateTagCompound? Do I have to call it manually or create an event handler. Also I know how to register each item in the arraylist on the nbt tag but not set the values back again on the nbt tag for an arraylist.
Also just to make sure would this work I am not 100% positive because I do not know where to call updateTagCompound and also just to make sure I call readInTagCompound at preInit?