wire/pipe hiding/reduced size
This commit is contained in:
parent
0db3a1d6df
commit
c9908ffa98
7 changed files with 69 additions and 23 deletions
|
@ -15,7 +15,7 @@ import static gregtech.api.enums.GT_Values.RES_PATH_ITEM;
|
|||
public class Textures {
|
||||
public enum BlockIcons implements IIconContainer, Runnable {
|
||||
VOID // The Empty Texture
|
||||
, RENDERING_ERROR, PIPE_RESTRICTOR, INSULATION_FULL, INSULATION_TINY, INSULATION_SMALL, INSULATION_MEDIUM, INSULATION_LARGE, INSULATION_HUGE, CFOAM_FRESH,
|
||||
, RENDERING_ERROR, PIPE_RESTRICTOR, INSULATION_FULL, INSULATION_TINY, INSULATION_SMALL, INSULATION_MEDIUM, INSULATION_MEDIUM_PLUS, INSULATION_LARGE, INSULATION_HUGE, CFOAM_FRESH,
|
||||
CFOAM_HARDENED, SOLARPANEL, SOLARPANEL_8V, SOLARPANEL_LV, SOLARPANEL_MV, SOLARPANEL_HV, SOLARPANEL_EV, SOLARPANEL_IV, SOLARPANEL_LuV, SOLARPANEL_ZPM,
|
||||
SOLARPANEL_UV, VENT_NORMAL, VENT_ADVANCED, COVER_WOOD_PLATE, ARROW_UP, ARROW_DOWN, ARROW_LEFT, ARROW_RIGHT, AUTOMATION_FILTER, AUTOMATION_TYPEFILTER,
|
||||
AUTOMATION_CHESTBUFFER, AUTOMATION_SUPERBUFFER, AUTOMATION_REGULATOR, CONCRETE_LIGHT_STONE, CONCRETE_LIGHT_COBBLE, CONCRETE_LIGHT_COBBLE_MOSSY,
|
||||
|
|
|
@ -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;
|
||||
|
@ -80,13 +81,17 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], Dyes.getModulation(aColorIndex, mMaterial.mRGBa) )};
|
||||
if (aConnected) {
|
||||
float tThickNess = getThickNess();
|
||||
if (tThickNess < 0.37F)
|
||||
if (tThickNess < 0.124F)
|
||||
return new ITexture[]{new GT_RenderedTexture(Textures.BlockIcons.INSULATION_FULL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
if (tThickNess < 0.374F)//0.375 x1
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_TINY, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
if (tThickNess < 0.49F)
|
||||
if (tThickNess < 0.499F)//0.500 x2
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_SMALL, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
if (tThickNess < 0.74F)
|
||||
if (tThickNess < 0.624F)//0.625 x4
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
if (tThickNess < 0.99F)
|
||||
if (tThickNess < 0.749F)//0.750 x8
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_MEDIUM_PLUS, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
if (tThickNess < 0.874F)//0.825 x12
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_LARGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[TextureSet.INDEX_wire], mMaterial.mRGBa), new GT_RenderedTexture(Textures.BlockIcons.INSULATION_HUGE, Dyes.getModulation(aColorIndex, Dyes.CABLE_INSULATION.mRGBa))};
|
||||
}
|
||||
|
@ -101,8 +106,8 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
|
||||
if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
|
||||
return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
|
||||
//if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ);
|
||||
return AxisAlignedBB.getBoundingBox(aX + 0.0625D, aY + 0.0625D, aZ + 0.0625D, aX + 0.9375D, aY + 0.9375D, aZ + 0.9375D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -251,7 +256,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -275,6 +280,7 @@ public class GT_MetaPipeEntity_Cable extends MetaPipeEntity implements IMetaTile
|
|||
|
||||
@Override
|
||||
public float getThickNess() {
|
||||
if(GT_Client.hideValue==1) return 0.0625F;
|
||||
return mThickNess;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,6 +16,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;
|
||||
|
@ -74,13 +75,15 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
|
|||
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) {
|
||||
if (aConnected) {
|
||||
float tThickNess = getThickNess();
|
||||
if (tThickNess < 0.37F)
|
||||
if (tThickNess < 0.124F)
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.374F)//0.375
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.49F)
|
||||
if (tThickNess < 0.499F)//0.500
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.74F)
|
||||
if (tThickNess < 0.749F)//0.750
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.99F)
|
||||
if (tThickNess < 0.874F)//0.825
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
}
|
||||
|
@ -143,7 +146,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
|
|||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) {
|
||||
return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D);
|
||||
return AxisAlignedBB.getBoundingBox(aX + 0.0625D, aY + 0.0625D, aZ + 0.0625D, aX + 0.9375D, aY + 0.9375D, aZ + 0.9375D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -269,7 +272,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
|
|||
}
|
||||
|
||||
oLastReceivedFrom = mLastReceivedFrom;
|
||||
}
|
||||
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -386,6 +389,7 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity {
|
|||
|
||||
@Override
|
||||
public float getThickNess() {
|
||||
if(GT_Client.hideValue==1) return 0.0625F;
|
||||
return mThickNess;
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
|
@ -72,13 +73,15 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
|
|||
if (mIsRestrictive) {
|
||||
if (aConnected) {
|
||||
float tThickNess = getThickNess();
|
||||
if (tThickNess < 0.37F)
|
||||
if (tThickNess < 0.124F)
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
if (tThickNess < 0.374F)//0.375
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
if (tThickNess < 0.49F)
|
||||
if (tThickNess < 0.499F)//0.500
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
if (tThickNess < 0.74F)
|
||||
if (tThickNess < 0.749F)//0.750
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
if (tThickNess < 0.99F)
|
||||
if (tThickNess < 0.874F)//0.825
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR)};
|
||||
}
|
||||
|
@ -86,13 +89,15 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
|
|||
}
|
||||
if (aConnected) {
|
||||
float tThickNess = getThickNess();
|
||||
if (tThickNess < 0.37F)
|
||||
if (tThickNess < 0.124F)
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.374F)//0.375
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.49F)
|
||||
if (tThickNess < 0.499F)//0.500
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.74F)
|
||||
if (tThickNess < 0.749F)//0.750
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
if (tThickNess < 0.99F)
|
||||
if (tThickNess < 0.874F)//0.825
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))};
|
||||
}
|
||||
|
@ -217,7 +222,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
|
|||
|
||||
if (isInventoryEmpty()) mLastReceivedFrom = 6;
|
||||
oLastReceivedFrom = mLastReceivedFrom;
|
||||
}
|
||||
}else if(aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected==4) aBaseMetaTileEntity.issueTextureUpdate();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -306,6 +311,7 @@ public class GT_MetaPipeEntity_Item extends MetaPipeEntity implements IMetaTileE
|
|||
|
||||
@Override
|
||||
public float getThickNess() {
|
||||
if(GT_Client.hideValue==1) return 0.0625F;
|
||||
return mThickNess;
|
||||
}
|
||||
}
|
|
@ -30,6 +30,7 @@ import net.minecraft.item.ItemStack;
|
|||
import net.minecraft.tileentity.TileEntity;
|
||||
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;
|
||||
|
@ -327,6 +328,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 +500,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;
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Loading…
Reference in a new issue