diff options
author | Jason Mitchell <mitchej@gmail.com> | 2022-02-04 14:50:55 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-04 23:50:55 +0100 |
commit | 2f85ea82f372efd8fae5ebff6c9f0bb81f2f63aa (patch) | |
tree | fbe5420120647fdad382f8b63a1515bff82576e8 /src/main/java/gregtech/common | |
parent | f77315eb88b266bfa4079cad2f60fbc533b83617 (diff) | |
download | GT5-Unofficial-2f85ea82f372efd8fae5ebff6c9f0bb81f2f63aa.tar.gz GT5-Unofficial-2f85ea82f372efd8fae5ebff6c9f0bb81f2f63aa.tar.bz2 GT5-Unofficial-2f85ea82f372efd8fae5ebff6c9f0bb81f2f63aa.zip |
Texture Shenanigans (#915)
* Texture Shenanigans
- Get rid of all the TODOs and run everything through the new Texture API in a backwards compatible way.
* allow bw runclient to run
* Add obf name
Co-authored-by: bombcar <github@bombcar.com>
Diffstat (limited to 'src/main/java/gregtech/common')
7 files changed, 100 insertions, 155 deletions
diff --git a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java index fdd20026ab..60e5d69fb9 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java @@ -8,17 +8,22 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; -class GT_CopiedBlockTexture implements ITexture, IBlockContainer { +public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, IBlockContainer { private final Block mBlock; private final byte mSide, mMeta; - GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + protected GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); mBlock = aBlock; mSide = (byte) aSide; mMeta = (byte) aMeta; } + @Override + public boolean isOldTexture() { + return false; + } + private IIcon getIcon(int aSide) { if (mSide == 6) return mBlock.getIcon(aSide, mMeta); return mBlock.getIcon(mSide, mMeta); @@ -28,81 +33,69 @@ class GT_CopiedBlockTexture implements ITexture, IBlockContainer { public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { IIcon aIcon = getIcon(ForgeDirection.EAST.ordinal()); aRenderer.field_152631_f = true; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer) .setupLightingXPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal()); new LightingHelper(aRenderer) .setupLightingXNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.UP.ordinal()); new LightingHelper(aRenderer) .setupLightingYPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.UP.ordinal(), 0xffffff); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal()); new LightingHelper(aRenderer) .setupLightingYNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal()); new LightingHelper(aRenderer) .setupLightingZPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal()); aRenderer.field_152631_f = true; new LightingHelper(aRenderer) .setupLightingZNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); aRenderer.field_152631_f = false; } diff --git a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java index fc83e4b687..a405649c33 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java @@ -9,7 +9,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.util.IIcon; import net.minecraftforge.common.util.ForgeDirection; -class GT_CopiedCTMBlockTexture implements ITexture, IBlockContainer { +class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBlockContainer { private final Block mBlock; private final byte mSide, mMeta; @@ -20,6 +20,11 @@ class GT_CopiedCTMBlockTexture implements ITexture, IBlockContainer { mMeta = (byte) aMeta; } + @Override + public boolean isOldTexture() { + return false; + } + private IIcon getIcon(int aSide, int aX, int aY, int aZ, RenderBlocks aRenderer) { int tSide = mSide == 6 ? aSide : mSide; return mBlock.getIcon(getBlockAccess(aRenderer), aX, aY, aZ, tSide); @@ -33,81 +38,69 @@ class GT_CopiedCTMBlockTexture implements ITexture, IBlockContainer { public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { IIcon aIcon = getIcon(ForgeDirection.EAST.ordinal(), aX, aY, aZ, aRenderer); aRenderer.field_152631_f = true; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer) .setupLightingXPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.EAST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); aRenderer.field_152631_f = false; } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer) .setupLightingXNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.WEST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.UP.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer) .setupLightingYPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.UP.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer) .setupLightingYNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.DOWN.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer) .setupLightingZPos(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.SOUTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal(), aX, aY, aZ, aRenderer); aRenderer.field_152631_f = true; new LightingHelper(aRenderer) .setupLightingZNeg(aBlock, aX, aY, aZ) .setupColor(ForgeDirection.NORTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); aRenderer.field_152631_f = false; } diff --git a/src/main/java/gregtech/common/render/GT_MultiTexture.java b/src/main/java/gregtech/common/render/GT_MultiTexture.java index eadcb39573..b72a6b1953 100644 --- a/src/main/java/gregtech/common/render/GT_MultiTexture.java +++ b/src/main/java/gregtech/common/render/GT_MultiTexture.java @@ -8,10 +8,10 @@ import net.minecraft.client.renderer.RenderBlocks; * <p>Lets Multiple ITextures Render overlay over each other.<</p> * <p>I should have done this much earlier...</p> */ -class GT_MultiTexture implements ITexture { +public class GT_MultiTexture extends GT_TextureBase implements ITexture { protected final ITexture[] mTextures; - GT_MultiTexture(ITexture... aTextures) { + protected GT_MultiTexture(ITexture... aTextures) { mTextures = aTextures; } diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java index 08ce2125f2..ca9d47bc67 100644 --- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java +++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java @@ -12,7 +12,6 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.LightingHelper; import net.minecraft.block.Block; -import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.entity.player.EntityPlayer; @@ -24,14 +23,14 @@ import net.minecraftforge.common.util.ForgeDirection; import static gregtech.api.util.LightingHelper.MAX_BRIGHTNESS; -class GT_RenderedTexture implements ITexture, IColorModulationContainer { +public class GT_RenderedTexture extends GT_TextureBase implements ITexture, IColorModulationContainer { protected final IIconContainer mIconContainer; private final short[] mRGBa; private final boolean glow; private final boolean stdOrient; private final boolean useExtFacing; - GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha, boolean glow, boolean stdOrient, boolean extFacing) { + protected GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha, boolean glow, boolean stdOrient, boolean extFacing) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); mIconContainer = aIcon; mRGBa = aRGBa; @@ -41,14 +40,16 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { } @Override + public boolean isOldTexture() { + return false; + } + + @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); @@ -62,23 +63,19 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); + startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); - if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); + lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingXNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.WEST.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); @@ -88,23 +85,19 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); - if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); + lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.UP.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); @@ -114,23 +107,19 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); - if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); + lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); @@ -140,23 +129,19 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); - if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); + lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZPos(aBlock, aX, aY, aZ).setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); @@ -166,23 +151,19 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - // TODO: Uncomment this once all addons have migrated to the new Texture API - //startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); + startDrawingQuads(aRenderer, 0.0f, 0.0f, -1.0f); final boolean enableAO = aRenderer.enableAO; LightingHelper lighting = new LightingHelper(aRenderer); if (glow) { - if (aRenderer.useInventoryTint) - return; // TODO: Remove this once all addons have migrated to the new Texture API if (!GT_Mod.gregtechproxy.mRenderGlowTextures) return; aRenderer.enableAO = false; lighting.setLightnessOverride(1.0F); - if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); + lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZNeg(aBlock, aX, aY, aZ).setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); @@ -192,8 +173,7 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; - // TODO: Uncomment this once all addons have migrated to the new Texture API - //draw(aRenderer); + draw(aRenderer); } @Override @@ -379,4 +359,4 @@ class GT_RenderedTexture implements ITexture, IColorModulationContainer { } return ExtendedFacing.DEFAULT; } -} +}
\ No newline at end of file diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index a9eafd7854..eb2b68ac57 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -462,30 +462,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aBlock.setBlockBoundsForItemRender(); aRenderer.setRenderBoundsFromBlock(aBlock); - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) DOWN.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) UP.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) NORTH.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) SOUTH.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) WEST.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tTileEntity.getTexture(aBlock, (byte) EAST.ordinal()), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API } else if (aMeta > 0 && (aMeta < GregTech_API.METATILEENTITIES.length) @@ -494,7 +476,6 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { && (!GregTech_API.METATILEENTITIES[aMeta].renderInInventory(aBlock, aMeta, aRenderer))) { renderNormalInventoryMetaTileEntity(aBlock, aMeta, aRenderer); } - aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); @@ -522,55 +503,19 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, false, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) (CONNECTED_WEST | CONNECTED_EAST), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API } else { - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, -1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) DOWN.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 1, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveYFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) UP.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, -1); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) NORTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(0, 0, 1); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveZFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) SOUTH.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(-1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderNegativeXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) WEST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.startDrawingQuads(); // TODO: Remove this once all addons have migrated to the new Texture API - Tessellator.instance.setNormal(1, 0, 0); // TODO: Remove this once all addons have migrated to the new Texture API renderPositiveXFacing(null, aRenderer, aBlock, 0, 0, 0, tMetaTileEntity.getTexture(iGregTechTileEntity, (byte) EAST.ordinal(), (byte) WEST.ordinal(), (byte) -1, true, false), true); - Tessellator.instance.draw(); // TODO: Remove this once all addons have migrated to the new Texture API } } diff --git a/src/main/java/gregtech/common/render/GT_SidedTexture.java b/src/main/java/gregtech/common/render/GT_SidedTexture.java index 9bdee73eb0..fbd5927467 100644 --- a/src/main/java/gregtech/common/render/GT_SidedTexture.java +++ b/src/main/java/gregtech/common/render/GT_SidedTexture.java @@ -7,7 +7,7 @@ import gregtech.api.render.TextureFactory; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; -class GT_SidedTexture implements ITexture, IColorModulationContainer { +public class GT_SidedTexture extends GT_TextureBase implements ITexture, IColorModulationContainer { protected final ITexture[] mTextures; /** * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! @@ -17,7 +17,7 @@ class GT_SidedTexture implements ITexture, IColorModulationContainer { */ private final short[] mRGBa; - GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa, boolean aAllowAlpha) { + protected GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa, boolean aAllowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); mTextures = new ITexture[]{ TextureFactory.of(aIcon0, aRGBa, aAllowAlpha), @@ -31,6 +31,11 @@ class GT_SidedTexture implements ITexture, IColorModulationContainer { } @Override + public boolean isOldTexture() { + return false; + } + + @Override public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { mTextures[5].renderXPos(aRenderer, aBlock, aX ,aY, aZ); } diff --git a/src/main/java/gregtech/common/render/GT_TextureBase.java b/src/main/java/gregtech/common/render/GT_TextureBase.java new file mode 100644 index 0000000000..b5b867810b --- /dev/null +++ b/src/main/java/gregtech/common/render/GT_TextureBase.java @@ -0,0 +1,29 @@ +package gregtech.common.render; + +import gregtech.api.interfaces.ITexture; +import gregtech.api.util.GT_UtilityClient; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraft.client.renderer.Tessellator; + +public abstract class GT_TextureBase implements ITexture { + protected boolean isDrawing = false; + + @Override + public void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) { + if (aRenderer.useInventoryTint && (!isOldTexture() || !GT_UtilityClient.isDrawing(Tessellator.instance))) { + // Draw if we're not an old texture OR we are an old texture AND we're not already drawing + isDrawing = true; + Tessellator.instance.startDrawingQuads(); + Tessellator.instance.setNormal(aNormalX, aNormalY, aNormalZ); + } + } + + @Override + public void draw(RenderBlocks aRenderer) { + if (aRenderer.useInventoryTint && (!isOldTexture() || isDrawing)) { + // Draw if we're not an old texture OR we initiated the drawing + isDrawing = false; + Tessellator.instance.draw(); + } + } +} |