aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/makamys/neodymium/util/MCUtil.java
blob: 2e14d16e5c1c364d8f48d3147f4fc81d9302fd52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package makamys.neodymium.util;

import static makamys.neodymium.Neodymium.LOGGER;

import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.biome.BiomeGenBase;

public class MCUtil {
    
    public static float getBiomeTemperatureVanilla(BiomeGenBase biome, int p_150564_1_, int p_150564_2_, int p_150564_3_){    
        if (p_150564_2_ > 64)
        {
            float f = (float)BiomeGenBase.temperatureNoise
                    .func_151601_a((double)p_150564_1_ * 1.0D / 8.0D, (double)p_150564_3_ * 1.0D / 8.0D) * 4.0F;
            return biome.temperature - (f + (float)p_150564_2_ - 64.0F) * 0.05F / 30.0F;
        }
        else
        {
            return biome.temperature;
        }
    }
    
    public static void showChatMessage(String text) {
        EntityPlayer player = Minecraft.getMinecraft().thePlayer;
        
        if(player != null) {
            ChatComponentText cc = new ChatComponentText(text);
            player.addChatComponentMessage(cc);
        } else {
            LOGGER.info(text);
        }
    }
    
}