Jump to content

Sour_Tooth

Members
  • Posts

    5
  • Joined

  • Last visited

Posts posted by Sour_Tooth

  1. 27 minutes ago, DavidM said:

    Override Biome#getGrassColorAtPos and calculate the color from the xyz coordinates.

    This would allow the grass color in your world to stay the same when Minecraft is relaunched, and allow the color to be the same on different client.

    How would this prevent a new color being generated when Minecraft launches? If I understand you correctly, the grass color at (0, 0) would still be equal to randomColor. If so, then the grass at (0, 0) would still be given a new color at launch.

  2. 9 minutes ago, DavidM said:

    1. Are you sure you've posted the correct code? That will not compile.

    2. Check out WorldSavedData. The documentation of which is at https://mcforge.readthedocs.io/en/latest/datastorage/worldsaveddata/.

     

    Thanks for responding!

     

    1. The code I posted was extracted from a much larger chunk of code. If you’d like, I can update the post with all the code necessary to compile and execute the mod in Minecraft. 

     

    2. This seems like it could work, but I’ll have to do some more research.

  3. Greetings,

     

    I am trying to make a mod that randomly generates biomes. My end goal is to call upon a method to generate a biome. Part of my code is this random number generator that generates the color of the grass. 

    static class BiomeGenCustom extends Biome {
    
    	public RandomBiome() {
    
    		int Color = myRandomBiome.randomColor();
    
    		@SideOnly(Side.CLIENT)
    		public int getGrassColorAtPos(BlockPos pos) {
    			return -Color;
    	}
    }

    The issue I've encountered is that myBiome's grass color is generated when Minecraft is launched. Consequently, myBiome's grass color will be re-generated (and changed) every time Minecraft is launched. 

    What I would like to happen is for myBiome's grass color to be generated when the world is made, and stay the same thenceforth.

    My current idea entails saving myBiome's grass color to myBiome.txt, and referencing that stored number on world load. I, however, have no clue as to how I would approach implementing this idea. 

     

    If you have any questions, let me know.

    Thanks,

        -     Riley

     

    (I am using 1.12.2)

×
×
  • Create New...

Important Information

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