diff --git a/src/main/java/gregtech/api/enums/Textures.java b/src/main/java/gregtech/api/enums/Textures.java index f60fa257..ffde4650 100644 --- a/src/main/java/gregtech/api/enums/Textures.java +++ b/src/main/java/gregtech/api/enums/Textures.java @@ -103,7 +103,9 @@ public class Textures { OVERLAY_FRONT_PROCESSING_ARRAY, OVERLAY_FRONT_OIL_DRILL_ACTIVE, OVERLAY_FRONT_OIL_DRILL, OVERLAY_FRONT_DIESEL_ENGINE_ACTIVE, OVERLAY_FRONT_DIESEL_ENGINE, OVERLAY_FRONT_PYROLYSE_OVEN_ACTIVE, OVERLAY_FRONT_PYROLYSE_OVEN, OVERLAY_FRONT_OIL_CRACKER_ACTIVE, OVERLAY_FRONT_OIL_CRACKER, OVERLAY_FRONT_DISTILLATION_TOWER_ACTIVE, OVERLAY_FRONT_DISTILLATION_TOWER, OVERLAY_FRONT_ASSEMBLY_LINE_ACTIVE, OVERLAY_FRONT_ASSEMBLY_LINE, OVERLAY_FRONT_ORE_DRILL_ACTIVE, OVERLAY_FRONT_ORE_DRILL, OVERLAY_TOP_CLEANROOM_ACTIVE, OVERLAY_TOP_CLEANROOM, - OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE; + OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR, OVERLAY_FRONT_LARGE_CHEMICAL_REACTOR_ACTIVE, + PIPE_RESTRICTOR_UP, PIPE_RESTRICTOR_DOWN, PIPE_RESTRICTOR_LEFT, PIPE_RESTRICTOR_RIGHT, PIPE_RESTRICTOR_NU, PIPE_RESTRICTOR_ND, PIPE_RESTRICTOR_NL, PIPE_RESTRICTOR_NR, + PIPE_RESTRICTOR_UD, PIPE_RESTRICTOR_UL, PIPE_RESTRICTOR_UR, PIPE_RESTRICTOR_DL, PIPE_RESTRICTOR_DR, PIPE_RESTRICTOR_LR; /** * Icon for Fresh CFoam 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 6ebc0ff4..0126d422 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 @@ -87,27 +87,63 @@ public class GT_MetaPipeEntity_Fluid extends MetaPipeEntity{ return new GT_MetaPipeEntity_Fluid(mName, mThickNess, mMaterial, mCapacity, mHeatResistance, mGasProof, mPipeAmount); } + protected static final byte[][] sRestrictionArray = new byte[][]{ + {2, 3, 5, 4}, + {2, 3, 4, 5}, + {1, 0, 4, 5}, + {1, 0, 4, 5}, + {1, 0, 2, 3}, + {1, 0, 2, 3}}; + @Override public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, byte aColorIndex, boolean aConnected, boolean aRedstone) { - if (aConnected) { - float tThickNess = getThickNess(); - 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.499F)//0.500 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - 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.874F)//0.825 - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (mPipeAmount == 4) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - if (mPipeAmount == 9) - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; - } - return new ITexture[]{new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + float tThickNess = getThickNess(); + if (mDisableInput == 0) return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa))}; + byte tMask = 0; + if (aSide >= 0 && aSide < 6) for (byte i = 0; i < 4; i++) if ((mDisableInput & (1 << sRestrictionArray[aSide][i])) != 0) tMask |= 1 << i; + return new ITexture[]{aConnected ? getBaseTexture(tThickNess, mPipeAmount, mMaterial, aColorIndex) : new GT_RenderedTexture(mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, mMaterial.mRGBa)), getRestrictorTexture(tMask)}; + } + + protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, byte aColorIndex) { + if (aPipeAmount >= 9) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aPipeAmount >= 4) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.124F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.374F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.499F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.749F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + if (aThickNess < 0.874F) return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } + + protected static final ITexture getRestrictorTexture(byte aMask) { + switch (aMask) { + case 1: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UP); + case 2: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DOWN); + case 3: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UD); + case 4: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LEFT); + case 5: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UL); + case 6: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DL); + case 7: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NR); + case 8: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_RIGHT); + case 9: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_UR); + case 10: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_DR); + case 11: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NL); + case 12: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_LR); + case 13: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_ND); + case 14: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR_NU); + case 15: return new GT_RenderedTexture(Textures.BlockIcons.PIPE_RESTRICTOR); + default: return null; + } + } + + @Override + public void onValueUpdate(byte aValue) { + mDisableInput = aValue; + } + + @Override + public byte getUpdateData() { + return mDisableInput; } @Override diff --git a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java index d0e6b431..710bd3a6 100644 --- a/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java +++ b/src/main/java/gregtech/loaders/preload/GT_Loader_MetaTileEntities.java @@ -1659,7 +1659,7 @@ public class GT_Loader_MetaTileEntities implements Runnable { } private static void generateFluidMultiPipes(Materials aMaterial, String name, String displayName, int startID, int baseCapacity, int heatCapacity, boolean gasProof){ - GT_OreDictUnificator.registerOre(OrePrefixes.pipeQuadruple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_" + name + "_Quadruple", "Quadruple " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity, heatCapacity, gasProof, 4).getStackForm(1L)); - GT_OreDictUnificator.registerOre(OrePrefixes.pipeNonuple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 1, "GT_Pipe_" + name + "_Nonuple", "Nonuple " + displayName + " Fluid Pipe", 0.875F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.pipeQuadruple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID, "GT_Pipe_" + name + "_Quadruple", "Quadruple " + displayName + " Fluid Pipe", 0.9F, aMaterial, baseCapacity, heatCapacity, gasProof, 4).getStackForm(1L)); + GT_OreDictUnificator.registerOre(OrePrefixes.pipeNonuple.get(aMaterial), new GT_MetaPipeEntity_Fluid(startID + 1, "GT_Pipe_" + name + "_Nonuple", "Nonuple " + displayName + " Fluid Pipe", 0.9F, aMaterial, baseCapacity / 3, heatCapacity, gasProof, 9).getStackForm(1L)); } } diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DL.png new file mode 100644 index 00000000..766311a9 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DOWN.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DOWN.png new file mode 100644 index 00000000..285fbf58 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DOWN.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DR.png new file mode 100644 index 00000000..4d35191c Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_DR.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LEFT.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LEFT.png new file mode 100644 index 00000000..a4e79be1 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LEFT.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LR.png new file mode 100644 index 00000000..9346841e Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_LR.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_ND.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_ND.png new file mode 100644 index 00000000..9c759e84 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_ND.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NL.png new file mode 100644 index 00000000..c59fde72 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NR.png new file mode 100644 index 00000000..9578cf6b Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NR.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NU.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NU.png new file mode 100644 index 00000000..4fdda008 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_NU.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_RIGHT.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_RIGHT.png new file mode 100644 index 00000000..87fc09f3 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_RIGHT.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UD.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UD.png new file mode 100644 index 00000000..1fd53d6d Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UD.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UL.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UL.png new file mode 100644 index 00000000..e1f7e75f Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UL.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UP.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UP.png new file mode 100644 index 00000000..344d2543 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UP.png differ diff --git a/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UR.png b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UR.png new file mode 100644 index 00000000..cc316b91 Binary files /dev/null and b/src/main/resources/assets/gregtech/textures/blocks/iconsets/PIPE_RESTRICTOR_UR.png differ