Jump to content
  • Home
  • Files
  • Docs
  • Merch
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved]Design Approach for adding snow for seasonal change
1.13 Update Notes for Mod Creators
Sign in to follow this  
Followers 1
aw_wolfe

[Solved]Design Approach for adding snow for seasonal change

By aw_wolfe, April 3, 2017 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

aw_wolfe    14

aw_wolfe

aw_wolfe    14

  • Stone Miner
  • aw_wolfe
  • Members
  • 14
  • 94 posts
Posted April 3, 2017 (edited)

I would like to add snow for seasonal changes and am not sure which approach makes the most sense...better design... Add the ability to snow in areas that are not normally set to snow.

 

The biomes have a boolean snow enabled, but it is read only, so can't change it. Also, the EntityRenderer.renderRainSnow also uses a float temperature value, which is biome specific (height modified), but is also read-only.

My options, as far as I can tell:

1) create a new biome for each one I want to replace an expose the temperature and snow enabled, which I can then set manually as the seasons progress. I've experimented with this, by using the BiomeManager and removing all forests, adding my own class derived form BiomeForest (but not working, something I'm doing isn't working)

2) create a new rain/snow manager that mimics MC behavior from EntityRenderer.renderRainSnow but with my modifications...seems easier to me to implement (mainly copy paste), but less flexible later.

 

I've been struggling to get option 1 working

ImmutableList <BiomeEntry> blist=BiomeManager.getBiomes(BiomeType.WARM);
	Iterator bit=blist.iterator();
	while(bit.hasNext()){
		BiomeEntry en=(BiomeEntry)bit.next();
		if(en.biome.getBiomeName().toLowerCase().contains("forest")){
			
			BiomeManager.removeBiome(BiomeType.WARM, en);
		}
	}
	blist=BiomeManager.getBiomes(BiomeType.COOL);
	bit=blist.iterator();
	while(bit.hasNext()){
		BiomeEntry en=(BiomeEntry)bit.next();
		if(en.biome.getBiomeName().toLowerCase().contains("forest")){
			
			BiomeManager.removeBiome(BiomeType.COOL, en);
		}
	}
//after removing all forest biomes with BiomeManager

BiomeProperties seasons_forest=new Biome.BiomeProperties("SForest").setTemperature(0.1F).setRainfall(0.8F).setSnowEnabled();
	
	BiomeManager.addBiome(BiomeType.WARM, new BiomeEntry(new BiomeForestR(BiomeForest.Type.NORMAL, seasons_forest), 10));
	BiomeManager.addBiome(BiomeType.COOL, new BiomeEntry(new BiomeForestR(BiomeForest.Type.NORMAL, seasons_forest), 10));
  
  //this generates a list with "Extreme Hills,Plains,Swampland,SForest
  ImmutableList<BiomeEntry> list=BiomeManager.getBiomes(BiomeType.WARM);
	Iterator it=list.iterator();
	System.out.println("Dump Biomes");
	while(it.hasNext()){
		
		BiomeEntry en=(BiomeEntry)it.next();
		System.out.println(en.biome.getBiomeName());
		
	}

But when I check by playing game the normal forest is created with temp 0.7 and snow enabled=false instead of my 0.1 and snow enable=true.

I am probably doing something wrong with replacing the forests, but I don't want to spend more time pursuing option 1, if it is not the best approach.

 

Thanks,

Tony

Edited April 5, 2017 by aw_wolfe
  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2096

Draco18s

Draco18s    2096

  • Reality Controller
  • Draco18s
  • Members
  • 2096
  • 14031 posts
Posted April 3, 2017 (edited)

Ok, this is like 4000 times more complicated than you think.Trust me, I did it.

 

The "can snow" boolean is basically garbage and controls nothing AFAICT. Snow is entirely governed by whether or not precipitation (rain) is allowed, the biome's temperature, and the Y level of the block (mountains are colder at the top).

 

You want seasons? You need to create a way to determine the date from the totalWorldTime, adjust the biome temperature and rainfall values as necessary (AND ON THE CLIENT), deal with chunk-border update problems (if no blocks change the grass color doesn't update), and let vanilla rain/snow stuff take over from there.

 

It's a bitch. It doesn't work very well, I had to do some really hackish things (in 1.7) that I'm not proud of, and getting ice to melt and prevent permanently freezing the ocean is basically impossible. 

Edited April 3, 2017 by Draco18s
  • Quote

Share this post


Link to post
Share on other sites

aw_wolfe    14

aw_wolfe

aw_wolfe    14

  • Stone Miner
  • aw_wolfe
  • Members
  • 14
  • 94 posts
Posted April 3, 2017

Thanks.

I already have a calendar, daytime/night cycle manager (longer days in summer, longer nights in winter). A weather controller (rain more in spring), etc....  The snow was an issue. I also still can't get my forest biome to replace the standard forest.  Is there a good biome tutorial for 1.11.2 ? All biomes tuts I've seen so far are for older version where most of the functions approaches are deprepricated.

 

I'll see if I can manually create own renderRainSnow  () and install on client players. Once I have the effect, then really just need to find where MC adds snow to blocks during snow to complete the effect.

 

I'll post code back here if I can get it working.

  • Quote

Share this post


Link to post
Share on other sites

OreCruncher    7

OreCruncher

OreCruncher    7

  • Creeper Killer
  • OreCruncher
  • Forge Modder
  • 7
  • 160 posts
Posted April 3, 2017

Sounds like Tough as Nails. :)  The repo is on Github if you want to take a peek.

  • Quote

Share this post


Link to post
Share on other sites

aw_wolfe    14

aw_wolfe

aw_wolfe    14

  • Stone Miner
  • aw_wolfe
  • Members
  • 14
  • 94 posts
Posted April 4, 2017

OreCruncher: thanks.....

Tough as Nails looks great. I figured I was re-inventing the wheel a bit on some of what I was doing, but was a good way for me to learn a new environment by starting from scratch on something. Though at some point, tearing your hair out stops being fun :).

 

Will go through it tomorrow, test it, and pull out what I need.

 

Tony

 

 

  • Quote

Share this post


Link to post
Share on other sites

Elix_x    75

Elix_x

Elix_x    75

  • Dragon Slayer
  • Elix_x
  • Members
  • 75
  • 878 posts
Posted April 4, 2017
9 hours ago, aw_wolfe said:

I also still can't get my forest biome to replace the standard forest.  Is there a good biome tutorial for 1.11.2 ? All biomes tuts I've seen so far are for older version where most of the functions approaches are deprepricated.

Because biomes use forge registries now (just like item and blocks), you can replace them using substitution aliases.

First, read up on forge registries here - http://mcforge.readthedocs.io/en/latest/concepts/registries/.

Now, to replace forest biome, register your own forest biome just like you would a new biome, then retrieve biome registry (either trough Biome or GameRegistry) and call #addSubstitutionAlias(String modid, ResourceLocation nameToReplace, Biome replacement).

  • Quote

Share this post


Link to post
Share on other sites

aw_wolfe    14

aw_wolfe

aw_wolfe    14

  • Stone Miner
  • aw_wolfe
  • Members
  • 14
  • 94 posts
Posted April 5, 2017

Elix_x,

 

Thanks. I've been going through the Tough as Nails code and they are not overriding biomes, but rather the weather system. I am slowing making my way through it, but wil skip the biome replacement idea for now.

Tony

  • Quote

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 1
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • AdieCraft
      Japanese Style Temple Base

      By AdieCraft · Posted 1 hour ago

      Hello there!   Check out my latest tutorial in my Japanese Builds series, building a Japanese Temple base.   Make sure to Subscribe, so you don't miss any future videos.   Thanks   Adie   Japanese Style Temple Base    
    • DaemonUmbra
      Forge crashes on start

      By DaemonUmbra · Posted 2 hours ago

      Forge for 1.13+ requires Java 8-10 Forge for 1.12.2- requires Java 8
    • GttiqwT
      [1.12.2] Multiple Structure Generation

      By GttiqwT · Posted 2 hours ago

      Yeah I get where you're coming from. I also watched harry talk's tutorial and at first it worked but then I got the problem that it wont spawn more than one structure otherwise it'll overlap and only spawn the latest one added. I tried to follow this tutorial again and it just didnt seem to work at all now. When I get more time ill have to do it again and then afterwards try and fix the issues with spawning more than one structure. I'm currently trying to fix the issue where it causes cascading gen lag but I dont know how to fix that quite yet either.
    • Draco18s
      Distinguish singleplayer vs. multiplayer

      By Draco18s · Posted 2 hours ago

      No. Your client code is sending information to make the server do things. Your server code is telling the server to do those same things (again).
    • solitone
      Distinguish singleplayer vs. multiplayer

      By solitone · Posted 3 hours ago

      This isn’t an issue but normal behaviour, is it?
  • Topics

    • AdieCraft
      0
      Japanese Style Temple Base

      By AdieCraft
      Started 1 hour ago

    • bitman
      1
      Forge crashes on start

      By bitman
      Started 3 hours ago

    • Merthew
      7
      [1.12.2] Multiple Structure Generation

      By Merthew
      Started November 7, 2018

    • solitone
      24
      Distinguish singleplayer vs. multiplayer

      By solitone
      Started December 5

    • TheGreenSquarez
      5
      Forge 28.1.10 won't show on launcher + 28.1.0 fails to work

      By TheGreenSquarez
      Started Wednesday at 11:21 AM

  • Who's Online (See full list)

    • AntonBespoiasov
    • jbredwards
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • [Solved]Design Approach for adding snow for seasonal change
  • Theme
  • Contact Us
  • Discord

Copyright © 2019 ForgeDevelopment LLC · Ads by Curse Powered by Invision Community