aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/GT_Client.java
diff options
context:
space:
mode:
authorJohannes Gäßler <updrn@student.kit.edu>2017-06-18 17:26:04 +0200
committerJohannes Gäßler <updrn@student.kit.edu>2017-06-18 17:26:04 +0200
commit668ca431a8039f920414f296e00194a164ce5f4e (patch)
treec808e407ae3f0c950bd201e735ce5bb99c34abe3 /src/main/java/gregtech/common/GT_Client.java
parenta739167c7f28c65b6f66960150791eb9d1181e29 (diff)
parent337b6fc66d25361095ad4eddd86992d92668be03 (diff)
downloadGT5-Unofficial-668ca431a8039f920414f296e00194a164ce5f4e.tar.gz
GT5-Unofficial-668ca431a8039f920414f296e00194a164ce5f4e.tar.bz2
GT5-Unofficial-668ca431a8039f920414f296e00194a164ce5f4e.zip
Merge remote-tracking branch 'origin/unstable' into OilRefining
Conflicts: src/main/java/gregtech/loaders/postload/GT_MachineRecipeLoader.java src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java
Diffstat (limited to 'src/main/java/gregtech/common/GT_Client.java')
-rw-r--r--src/main/java/gregtech/common/GT_Client.java71
1 files changed, 71 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java
index ff4968cd16..7d3f687b28 100644
--- a/src/main/java/gregtech/common/GT_Client.java
+++ b/src/main/java/gregtech/common/GT_Client.java
@@ -9,6 +9,7 @@ import codechicken.lib.vec.Rotation;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
+import gregtech.GT_Mod;
import gregtech.api.GregTech_API;
import gregtech.api.enums.GT_Values;
import gregtech.api.enums.Materials;
@@ -30,6 +31,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
+import net.minecraftforge.client.event.EntityViewRenderEvent;
+import net.minecraftforge.event.terraingen.BiomeEvent;
+import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import java.net.URL;
@@ -139,6 +143,44 @@ public class GT_Client extends GT_Proxy
GL11.glEnd();
GL11.glPopMatrix();
}
+
+ @SubscribeEvent
+ public void manipulateDensity(EntityViewRenderEvent.FogDensity event) {
+ if(GT_Pollution.mPlayerPollution > (GT_Mod.gregtechproxy.mPollutionSmogLimit)){
+ event.density = (0.15f*(Math.min(GT_Pollution.mPlayerPollution/((float)GT_Mod.gregtechproxy.mPollutionSourRainLimit),1.0f)))+0.1f;
+ event.setCanceled(true);
+ }
+ }
+
+ @SubscribeEvent
+ public void manipulateColor(EntityViewRenderEvent.FogColors event) {
+ if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ event.red = 140f/255f;
+ event.green = 80f/255f;
+ event.blue = 40f/255f;
+ }
+ }
+
+ @SubscribeEvent
+ public void manipulateGrassColor(BiomeEvent.GetGrassColor event) {
+ if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ event.newColor = 0xD2691E;
+ }
+ }
+
+ @SubscribeEvent
+ public void manipulateWaterColor(BiomeEvent.GetWaterColor event) {
+ if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ event.newColor = 0x556B2F;
+ }
+ }
+
+ @SubscribeEvent
+ public void manipulateFoliageColor(BiomeEvent.GetFoliageColor event) {
+ if(GT_Pollution.mPlayerPollution > GT_Mod.gregtechproxy.mPollutionSmogLimit){
+ event.newColor = 0xCD853F;
+ }
+ }
public boolean isServerSide() {
return true;
@@ -327,6 +369,12 @@ public class GT_Client extends GT_Proxy
@SubscribeEvent
public void onClientTickEvent(cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent aEvent) {
if (aEvent.phase == cpw.mods.fml.common.gameevent.TickEvent.Phase.END) {
+ if(changeDetected>0)changeDetected--;
+ int newHideValue=shouldHeldItemHideThings();
+ if(newHideValue!=hideValue){
+ hideValue=newHideValue;
+ changeDetected=5;
+ }
mAnimationTick++;
if (mAnimationTick % 50L == 0L)
{mAnimationDirection = !mAnimationDirection;}
@@ -493,4 +541,27 @@ public class GT_Client extends GT_Proxy
else
aWorld.playSound(aX, aY, aZ, tString, 3F, tString.startsWith("note.") ? (float) Math.pow(2D, (double) (aStack.stackSize - 13) / 12D) : 1.0F, false);
}
+
+ public static int hideValue=0;
+ public static int changeDetected=0;
+
+ private static int shouldHeldItemHideThings() {
+ try {
+ EntityPlayer player = Minecraft.getMinecraft().thePlayer;
+ if (player == null) return 0;
+ ItemStack held = player.getCurrentEquippedItem();
+ if (held == null) return 0;
+ int[] ids = OreDictionary.getOreIDs(held);
+ int hide = 0;
+ for (int i : ids) {
+ if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) {
+ hide |= 0x1;
+ break;
+ }
+ }
+ return hide;
+ }catch(Exception e){
+ return 0;
+ }
+ }
} \ No newline at end of file