Add pipe/wire hiding when holding soldering iron.

This commit is contained in:
Technus 2016-11-27 12:34:02 +01:00
parent 3362fe92a7
commit d47a698e19
4 changed files with 28 additions and 29 deletions

View file

@ -17,6 +17,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client;
import ic2.api.energy.tile.IEnergySink;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -300,6 +301,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
@Override
public float getThickNess() {
if(GT_Client.hideValue==1) return 0.125F;
return mThickNess;
}

View file

@ -12,6 +12,7 @@ import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.objects.XSTR;
import gregtech.api.util.GT_Log;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.ItemStack;
@ -382,6 +383,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
@Override
public float getThickNess() {
if(GT_Client.hideValue==1) return 0.125F;
return mThickNess;
}
}

View file

@ -10,6 +10,7 @@ import gregtech.api.metatileentity.BaseMetaPipeEntity;
import gregtech.api.metatileentity.MetaPipeEntity;
import gregtech.api.objects.GT_RenderedTexture;
import gregtech.api.util.GT_Utility;
import gregtech.common.GT_Client;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
@ -313,6 +314,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
@Override
public float getThickNess() {
if(GT_Client.hideValue==1) return 0.125F;
return mThickNess;
}
}

View file

@ -36,6 +36,7 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.world.World;
import net.minecraftforge.client.event.DrawBlockHighlightEvent;
import net.minecraftforge.oredict.OreDictionary;
import org.lwjgl.opengl.GL11;
import java.net.URL;
@ -370,7 +371,7 @@ 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) {
//hideValue=shouldHeldItemHideThings();
hideValue=shouldHeldItemHideThings();
mAnimationTick++;
if (mAnimationTick % 50L == 0L)
{mAnimationDirection = !mAnimationDirection;}
@ -538,33 +539,25 @@ public class GT_Client extends GT_Proxy
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 hideValue=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("craftingToolWrench")) {
// hide |= 0x1;
// continue;
// }
// if (OreDictionary.getOreName(i).equals("craftingToolWireCutter")) {
// hide |= 0x2;
// continue;
// }
// if (OreDictionary.getOreName(i).equals("craftingToolSolderingIron")) {
// hide |= 0x3;
// continue;
// }
// }
// return hide;
// }catch(Exception e){
// return 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;
}
}
}