diff options
| author | Technus <daniel112092@gmail.com> | 2017-06-04 09:28:43 +0200 | 
|---|---|---|
| committer | Technus <daniel112092@gmail.com> | 2017-06-04 09:28:43 +0200 | 
| commit | c9908ffa98153a925c98024f5c540445399bc95d (patch) | |
| tree | c88b74c68e568adb15d5342c9b24a5d1057d0575 | |
| parent | 0db3a1d6df646598d8353b2a5a2ad46291ea86f5 (diff) | |
| download | GT5-Unofficial-c9908ffa98153a925c98024f5c540445399bc95d.tar.gz GT5-Unofficial-c9908ffa98153a925c98024f5c540445399bc95d.tar.bz2 GT5-Unofficial-c9908ffa98153a925c98024f5c540445399bc95d.zip | |
wire/pipe hiding/reduced size
7 files changed, 69 insertions, 23 deletions
| diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index d2894ad7bd..87089a33b8 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -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,  diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java index fdb3c0da8b..d6d1985e13 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Cable.java @@ -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;      } diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java index effff677d7..ddba7b39bf 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Fluid.java @@ -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;      }  }
\ No newline at end of file diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java index e08ae2fb1a..5be230504a 100644 --- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java +++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Item.java @@ -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;      }  }
\ No newline at end of file diff --git a/src/main/java/gregtech/common/GT_Client.java b/src/main/java/gregtech/common/GT_Client.java index ff4968cd16..494e399762 100644 --- a/src/main/java/gregtech/common/GT_Client.java +++ b/src/main/java/gregtech/common/GT_Client.java @@ -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; +        } +    }  }
\ No newline at end of file diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.pngBinary files differ index 72c4f05658..7f896a09f0 100644 --- a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_LARGE.png diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.pngBinary files differ new file mode 100644 index 0000000000..666d51b82f --- /dev/null +++ b/src/main/resources/assets/gregtech/textures/blocks/iconsets/INSULATION_MEDIUM_PLUS.png | 
