Ok, I have given it a go, searching through many different threads on the forums to try to understand the save data and writing to nbt/reading from it. I'm not really too familiar with these.
Im using 1.8 so hence why perMapStorage has changed to a getter. I am getting a null pointer error in the WorldIslandData get method. If anyone could help it would be greatly appreciated and offer some sort of explanation. Thanks.
Extended World Save Data Class
public class WorldIslandData extends WorldSavedData {
private static final String IDENTIFIER = "islanddata";
public static Random rand = new Random();
public int[] RandomNameNumber = new int[]{rand.nextInt(5),rand.nextInt(5),rand.nextInt(5),rand.nextInt(5)};
public WorldIslandData() {
super(IDENTIFIER);
}
public WorldIslandData(String identifier) {
super(identifier);
}
@Override
public void readFromNBT(NBTTagCompound nbt) {
for(int i = 0; i < RandomNameNumber.length; i++){
RandomNameNumber[i] = nbt.getInteger("namenum"+i);
}
}
@Override
public void writeToNBT(NBTTagCompound nbt) {
for(int i = 0; i < RandomNameNumber.length; i++){
nbt.setInteger("namenum" + i, i);
}
}
public static WorldIslandData get(World world) {
MapStorage storage = world.getMapStorage();
WorldIslandData data = (WorldIslandData)storage.loadData(WorldIslandData.class, IDENTIFIER);
if (data == null)
{
data = new WorldIslandData();
storage.setData(IDENTIFIER, data);
}
return data;
}
}
Output Class
public class IslandHolder extends BiomeGenBase {
protected static World worldObj;
public IslandHolder(int par1) {
super(par1);
// TODO Auto-generated constructor stub
}
public static void declareBiomes()
{
WorldIslandData data = WorldIslandData.get(worldObj);
for (int i = 1; i<5; ++i)
{
BiomeGenBase island = (new IslandGen(i).setBiomeName(String.valueOf(i) + " Rand " + String.valueOf(data.RandomNameNumber[i-1])));
}
}
}