Jump to content

Litigator

Members
  • Posts

    6
  • Joined

  • Last visited

Converted

  • Gender
    Undisclosed
  • Personal Text
    I am new!

Litigator's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. Thanks diesieben07. Some oversights there from me. 1. I removed that. Stupid me. I then passed the world into the method and then called it in my custom chunk provider. This all seems to work. public static void declareBiomes(World world) { WorldIslandData data = WorldIslandData.get(world); for (int i = 1; i<5; ++i) { BiomeGenBase island = (new IslandGen(i).setBiomeName(String.valueOf(i) + " Rand " + String.valueOf(data.RandomNameNumber[i-1]))); } and showing it from the CustomChunkProviderGenerate public Chunk provideChunk(int x, int z) { this.rand.setSeed((long)x * 341873128712L + (long)z * 132897987541L); IslandHolder.declareBiomes(worldObj); ChunkPrimer chunkprimer = new ChunkPrimer(); 2. Fixed it. I think? 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); } @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, RandomNameNumber[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; } } Ok so its no longer giving a NPE. Right now it seems it can read values from the NBT but it still does not save it when you close the world and re-open? Im assuming there must be something wrong in my logic?
  2. 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]))); } } }
  3. Every time a new world/game is created I am looking to generate a set of values ( based on random numbers) and then apply those to the world as it generates. If I call the method to generate these values in any of the FML events, pre init/post init etc means that every time the game is quit, a new set of random values is generating.. thus changing the state of the world every time you quit and re enter. How would i save this set of values for every time a new world is created?
  4. The float variable getSunBrightness is used to calculate the light level at any time of day. By allowing access to it, modders will be able to make days and nights darker/brighter at any given time. I feel like this would be an easy change, but as I am nowhere near yet competent enough in Java I'm not to sure completely how to do it. Maybe move it into the worldprovider? Thanks for taking the time to read this suggestion.
  5. Yeah you are right about shore it sets the rules for the border biomes beaches and x hills edges etc. I've also worked out each time a gen layer zoom is called it expands everything above it by x4. So for example if you called it twice after add mushroom island, mushroom islands would be 16x bigger, along with the whole world too. The confusing parts begin inside the classes where it's unclear whether an int is just a number used in the maths or whether its referring to a biome Id. Often lots of zeros refer to the ocean biome as its index is 0
  6. I'm attempting to do some heavy world generation modding with regard to the Gen Layer Classes. So far I have worked out some things, but there are just so many variable that it is really impossible to try and understand fully what is going on. Currently the way minecraft generates the world through gen layer seems to be a zooming fractal function. This was kind of explained almost a year ago now, in this http://www.minecraftforge.net/forum/index.php?topic=438.0, but through searching I have not found any more information on the procedure. Personally I'm looking to make layers of rings of biomes which would make interesting island terrain. Eg Ocean >(Inside the ocean) Coast >(Inside the coast) Hinterlands>(Inside the hinterlands) Highlands etc. Does anyone have a good grasp of the genlayer system? Or can explain it any further than in the thread I previously linked? Thanks
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.