_gjkf_ Posted September 24, 2014 Share Posted September 24, 2014 Hello everyone!!!I'm trying to make a mod that would allow the player to forecast the weather. I added a Block that - when placed - writes to NBT the temperature and the humidity of the biome where the block is placed in. Now, I was able to get the temperature and the humidity of the biome but one of the factors of forecasting is Atmospheric Pressure. How can I add atmospheric pressure into Minecraft? I found the Temperature and the Humidity of the Biome from the BiomeGenBase class. How can I add to that class my variable with it's own methods (getters and setters) and make sure that every new world/chunk has that in? Is there any other better way to do it? This is what I've got so far: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/Station.java // The Weather Station block https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/te/StationTE.java // The Weather Station TileEntity https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/proxy/CommonProxy.java // Common Proxy, I register the TEs Thanks guys, any help would be really appreciated. Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 24, 2014 Author Share Posted September 24, 2014 Thanks for your quick reply. Does my class need to extend something? Where do I create the new instance of that class and in the end, where do I put the map? Sorry for my dumbness Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 24, 2014 Author Share Posted September 24, 2014 Then you create a new instance of that class for every biome and put it in the Map. That's why I asked you where I create the instance, I mean in which class. I guess it would make sense to do it in the same class where the Map is. Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 24, 2014 Author Share Posted September 24, 2014 Ok, so something like this biomesMap.put(new BiomeGenOcean(0), new Pressure()); biomesMap.put(new BiomeGenPlains(1), new Pressure()); biomesMap.put(new BiomeGenDesert(2), new Pressure()); just for all the biomes, right? Here's Pressure package com.gjkf.fc.weather; import net.minecraft.world.biome.BiomeGenBase; public class Pressure { public float pressure; public float getPressure(){ return pressure; } public void setPressure(float temperature, float humidity){ pressure = temperature * 25 + humidity * 100; } } Am I doing it right? If so, how would I then be sure that that's actually working? If not, what am I doing wrong? I have never used Maps, I'm only 15. Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 24, 2014 Author Share Posted September 24, 2014 Thanks, I will look into maps, you are right about learning Java while modding isn't a good idea. I tried because I thought I had enough knowledge. Apparently I don't. Back to study then!!! Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 25, 2014 Author Share Posted September 25, 2014 I got it to work properly. Instead of doing what you suggested me, I used a double for the temperature, then I calculated the Atmospherical Pressure based on that. The temperature I choose is arbitrary, not related to the Minecraft one. I have a last question: What if there's Biomes O' Plenty installed along with my mod? I choose Biomes O' Plenty but I could choose any mod that add Biomes. How can I detect if there are another biomes a part of the Vanilla ones? If you want code examples go here: https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/Main.java#L82-L119 //Main where the Map is https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/weather/Pressure.java#L39-L41 //The Pressure Class https://github.com/gjkf/ForeCraft/blob/master/src/main/java/com/gjkf/fc/blocks/Station.java#L111-L117 //The Weather Station Block Class Thanks for your huge help. Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
GotoLink Posted September 25, 2014 Share Posted September 25, 2014 You can initialize your values in FMLPostInit event, and from the BiomeGenBase array, guess the "temperature" values from BiomeDictionary tags. Quote Link to comment Share on other sites More sharing options...
_gjkf_ Posted September 26, 2014 Author Share Posted September 26, 2014 Thanks for the help, it works!!! Quote "I an atom in the universe, a universe of atoms"-- Richard P. Feynman Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.