diff options
Diffstat (limited to 'src/main/java/gregtech')
13 files changed, 141 insertions, 540 deletions
diff --git a/src/main/java/gregtech/api/interfaces/ITexture.java b/src/main/java/gregtech/api/interfaces/ITexture.java index 4c0b1984ca..b05f31d14f 100644 --- a/src/main/java/gregtech/api/interfaces/ITexture.java +++ b/src/main/java/gregtech/api/interfaces/ITexture.java @@ -18,12 +18,12 @@ public interface ITexture { void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ); boolean isValidTexture(); - + /** * @return {@code true} if this texture is from the old package */ default boolean isOldTexture() { - return getClass().toString().startsWith("gregtech.api.objects"); + return true; } /** @@ -34,7 +34,7 @@ public interface ITexture { * @param aNormalZ The Z Normal for current Quad Face */ default void startDrawingQuads(RenderBlocks aRenderer, float aNormalX, float aNormalY, float aNormalZ) { - if (aRenderer.useInventoryTint) { + if (aRenderer.useInventoryTint && !isOldTexture()) { Tessellator.instance.startDrawingQuads(); Tessellator.instance.setNormal(aNormalX, aNormalY, aNormalZ); } @@ -45,7 +45,7 @@ public interface ITexture { * @param aRenderer The {@link RenderBlocks} Renderer */ default void draw(RenderBlocks aRenderer) { - if (aRenderer.useInventoryTint) { + if (aRenderer.useInventoryTint && !isOldTexture()) { Tessellator.instance.draw(); } } diff --git a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java index 61136c8f40..8022b4f129 100644 --- a/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/api/objects/GT_CopiedBlockTexture.java @@ -2,35 +2,20 @@ package gregtech.api.objects; import gregtech.api.enums.Dyes; import gregtech.api.interfaces.ITexture; -import gregtech.api.util.LightingHelper; import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.util.IIcon; -import net.minecraftforge.common.util.ForgeDirection; + /** * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated -public class GT_CopiedBlockTexture implements ITexture { - private final Block mBlock; - private final byte mSide, mMeta; - private final boolean mAllowAlpha; - /** - * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! - * <p/> - * Just set this variable to another different Array instead. - * Otherwise some colored things will get Problems. - */ - public short[] mRGBa; +public class GT_CopiedBlockTexture extends gregtech.common.render.GT_CopiedBlockTexture implements ITexture { + // Backwards Compat + @Deprecated public short[] mRGBa; public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean aAllowAlpha) { - if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); - mBlock = aBlock; - mRGBa = aRGBa; - mSide = (byte) aSide; - mMeta = (byte) aMeta; - mAllowAlpha = aAllowAlpha; + super(aBlock, aSide, aMeta, aRGBa, aAllowAlpha); + GT_CopiedBlockTexture.this.mRGBa = aRGBa; } public GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa) { @@ -41,79 +26,7 @@ public class GT_CopiedBlockTexture implements ITexture { this(aBlock, aSide, aMeta, Dyes._NULL.mRGBa); } - private IIcon getIcon(int aSide) { - if (mSide == 6) return mBlock.getIcon(aSide, mMeta); - return mBlock.getIcon(mSide, mMeta); - } - - @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - IIcon aIcon = getIcon(ForgeDirection.EAST.ordinal()); - aRenderer.field_152631_f = true; - new LightingHelper(aRenderer) - .setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); - aRenderer.field_152631_f = false; - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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); - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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); - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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); - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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); - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - 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); - aRenderer.field_152631_f = false; - } - - @Override - public boolean isValidTexture() { - return mBlock != null; - } - - public Block getBlock() { - return mBlock; - } - - public byte getMeta() { - return mMeta; + public boolean isOldTexture() { + return true; } } diff --git a/src/main/java/gregtech/api/objects/GT_MultiTexture.java b/src/main/java/gregtech/api/objects/GT_MultiTexture.java index 9d664b4dfb..51ab7615b4 100644 --- a/src/main/java/gregtech/api/objects/GT_MultiTexture.java +++ b/src/main/java/gregtech/api/objects/GT_MultiTexture.java @@ -1,8 +1,6 @@ package gregtech.api.objects; import gregtech.api.interfaces.ITexture; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; /** * <p>Lets Multiple ITextures Render overlay over each other.<</p> @@ -10,51 +8,13 @@ import net.minecraft.client.renderer.RenderBlocks; * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated -public class GT_MultiTexture implements ITexture { - private final ITexture[] mTextures; - +public class GT_MultiTexture extends gregtech.common.render.GT_MultiTexture implements ITexture { public GT_MultiTexture(ITexture... aTextures) { - mTextures = aTextures; - } - - @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderXPos(aRenderer, aBlock, aX, aY, aZ); - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderXNeg(aRenderer, aBlock, aX, aY, aZ); - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderYPos(aRenderer, aBlock, aX, aY, aZ); - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderYNeg(aRenderer, aBlock, aX, aY, aZ); - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderZPos(aRenderer, aBlock, aX, aY, aZ); - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - for (ITexture tTexture : mTextures) - if (tTexture != null && tTexture.isValidTexture()) tTexture.renderZNeg(aRenderer, aBlock, aX, aY, aZ); + super(aTextures); } @Override - public boolean isValidTexture() { + public boolean isOldTexture() { return true; } } diff --git a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java index 12d013303c..1f123274f4 100644 --- a/src/main/java/gregtech/api/objects/GT_RenderedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_RenderedTexture.java @@ -4,29 +4,14 @@ import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; -import gregtech.api.util.LightingHelper; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; -import net.minecraft.client.renderer.Tessellator; -import net.minecraft.util.IIcon; -import net.minecraftforge.common.util.ForgeDirection; @Deprecated -public class GT_RenderedTexture implements ITexture, IColorModulationContainer { - final IIconContainer mIconContainer; - final boolean mAllowAlpha; - /** - * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! - * <p/> - * Just set this variable to another different Array instead. - * Otherwise some colored things will get Problems. - */ - public short[] mRGBa; +public class GT_RenderedTexture extends gregtech.common.render.GT_RenderedTexture implements ITexture, IColorModulationContainer { + @Deprecated public short[] mRGBa; public GT_RenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { + super(aIcon, aRGBa, aAllowAlpha, false, true, false); if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_RenderedTexture"); - mIconContainer = aIcon; - mAllowAlpha = aAllowAlpha; mRGBa = aRGBa; } @@ -39,170 +24,7 @@ public class GT_RenderedTexture implements ITexture, IColorModulationContainer { } @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - aRenderer.field_152631_f = true; - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), mRGBa); - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); - aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - aRenderer.field_152631_f = false; - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), mRGBa); - aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); - aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), mRGBa); - aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); - aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - final Tessellator tessellator = Tessellator.instance; - IIcon aIcon = mIconContainer.getIcon(); - - float minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); - float maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); - float minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - float maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - minU = 16.0F - aIcon.getMaxU(); - maxU = 16.0F - aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - minV = aIcon.getMinV(); - maxV = aIcon.getMaxV(); - } - - double minX = aX + aRenderer.renderMinX; - double maxX = aX + aRenderer.renderMaxX; - double minY = aY + aRenderer.renderMinY; - double minZ = aZ + aRenderer.renderMinZ; - double maxZ = aZ + aRenderer.renderMaxZ; - - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - } else { - tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); - tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); - tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); - } - tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); - - if (mIconContainer.getOverlayIcon() != null) { - minU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMaxX) * 16.0D); - maxU = aIcon.getInterpolatedU((1.0D - aRenderer.renderMinX) * 16.0D); - minV = aIcon.getInterpolatedV(aRenderer.renderMinZ * 16.0D); - maxV = aIcon.getInterpolatedV(aRenderer.renderMaxZ * 16.0D); - - if (aRenderer.renderMinX < 0.0D || aRenderer.renderMaxX > 1.0D) { - minU = 16.0F - aIcon.getMaxU(); - maxU = 16.0F - aIcon.getMinU(); - } - - if (aRenderer.renderMinZ < 0.0D || aRenderer.renderMaxZ > 1.0D) { - minV = aIcon.getMinV(); - maxV = aIcon.getMaxV(); - } - - minX = aX + (float)aRenderer.renderMinX; - maxX = aX + (float)aRenderer.renderMaxX; - minY = aY + (float)aRenderer.renderMinY; - minZ = aZ + (float)aRenderer.renderMinZ; - maxZ = aZ + (float)aRenderer.renderMaxZ; - - lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); - - if (aRenderer.enableAO) { - tessellator.setColorOpaque_F(aRenderer.colorRedTopLeft, aRenderer.colorGreenTopLeft, aRenderer.colorBlueTopLeft); - tessellator.setBrightness(aRenderer.brightnessTopLeft); - tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomLeft, aRenderer.colorGreenBottomLeft, aRenderer.colorBlueBottomLeft); - tessellator.setBrightness(aRenderer.brightnessBottomLeft); - tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); - tessellator.setColorOpaque_F(aRenderer.colorRedBottomRight, aRenderer.colorGreenBottomRight, aRenderer.colorBlueBottomRight); - tessellator.setBrightness(aRenderer.brightnessBottomRight); - tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); - tessellator.setColorOpaque_F(aRenderer.colorRedTopRight, aRenderer.colorGreenTopRight, aRenderer.colorBlueTopRight); - tessellator.setBrightness(aRenderer.brightnessTopRight); - } else { - tessellator.addVertexWithUV(minX, minY, maxZ, maxU, maxV); - tessellator.addVertexWithUV(minX, minY, minZ, maxU, minV); - tessellator.addVertexWithUV(maxX, minY, minZ, minU, minV); - } - tessellator.addVertexWithUV(maxX, minY, maxZ, minU, maxV); - } - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); - aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); - aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - aRenderer.field_152631_f = true; - LightingHelper lighting = new LightingHelper(aRenderer); - lighting.setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); - aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); - if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); - aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); - } - aRenderer.field_152631_f = false; - } - - @Override - public short[] getRGBA() { - return mRGBa; - } - - @Override - public boolean isValidTexture() { - return mIconContainer != null; + public boolean isOldTexture() { + return true; } } diff --git a/src/main/java/gregtech/api/objects/GT_SidedTexture.java b/src/main/java/gregtech/api/objects/GT_SidedTexture.java index c6ed003be9..3c699a3f4b 100644 --- a/src/main/java/gregtech/api/objects/GT_SidedTexture.java +++ b/src/main/java/gregtech/api/objects/GT_SidedTexture.java @@ -4,34 +4,19 @@ import gregtech.api.enums.Dyes; import gregtech.api.interfaces.IColorModulationContainer; import gregtech.api.interfaces.IIconContainer; import gregtech.api.interfaces.ITexture; -import net.minecraft.block.Block; -import net.minecraft.client.renderer.RenderBlocks; /** * @deprecated Replaced by the {@link gregtech.api.render.TextureFactory} API. */ @Deprecated -public class GT_SidedTexture implements ITexture, IColorModulationContainer { - private final ITexture[] mTextures; - /** - * DO NOT MANIPULATE THE VALUES INSIDE THIS ARRAY!!! - * <p/> - * Just set this variable to another different Array instead. - * Otherwise some colored things will get Problems. - */ - public short[] mRGBa; +public class GT_SidedTexture extends gregtech.common.render.GT_SidedTexture implements ITexture, IColorModulationContainer { + @Deprecated public short[] mRGBa; public 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[]{ - new GT_RenderedTexture(aIcon0, aRGBa, aAllowAlpha), - new GT_RenderedTexture(aIcon1, aRGBa, aAllowAlpha), - new GT_RenderedTexture(aIcon2, aRGBa, aAllowAlpha), - new GT_RenderedTexture(aIcon3, aRGBa, aAllowAlpha), - new GT_RenderedTexture(aIcon4, aRGBa, aAllowAlpha), - new GT_RenderedTexture(aIcon5, aRGBa, aAllowAlpha) - }; - mRGBa = aRGBa; + super(aIcon0, aIcon1, aIcon2, aIcon3, aIcon4, aIcon5, aRGBa, aAllowAlpha); + + // Backwards Compat + GT_SidedTexture.this.mRGBa = aRGBa; } public GT_SidedTexture(IIconContainer aIcon0, IIconContainer aIcon1, IIconContainer aIcon2, IIconContainer aIcon3, IIconContainer aIcon4, IIconContainer aIcon5, short[] aRGBa) { @@ -51,45 +36,7 @@ public class GT_SidedTexture implements ITexture, IColorModulationContainer { } @Override - public void renderXPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[5].renderXPos(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public void renderXNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[4].renderXNeg(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public void renderYPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[1].renderYPos(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[0].renderYNeg(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public void renderZPos(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[3].renderZPos(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public void renderZNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { - mTextures[2].renderZNeg(aRenderer, aBlock, aX ,aY, aZ); - } - - @Override - public short[] getRGBA() { - return mRGBa; - } - - @Override - public boolean isValidTexture() { - for (ITexture renderedTexture : mTextures) { - if (!renderedTexture.isValidTexture()) return false; - } + public boolean isOldTexture() { return true; } } diff --git a/src/main/java/gregtech/api/util/GT_UtilityClient.java b/src/main/java/gregtech/api/util/GT_UtilityClient.java index abad0e9e90..bb161802ed 100644 --- a/src/main/java/gregtech/api/util/GT_UtilityClient.java +++ b/src/main/java/gregtech/api/util/GT_UtilityClient.java @@ -1,14 +1,28 @@ package gregtech.api.util; import com.google.common.collect.Lists; +import cpw.mods.fml.relauncher.ReflectionHelper; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumChatFormatting; +import java.lang.reflect.Field; import java.util.List; public class GT_UtilityClient { + private static final Field isDrawingField = ReflectionHelper.findField(Tessellator.class, "isDrawing", "field_78415_z"); + + public static boolean isDrawing(Tessellator tess) { + try { + return isDrawingField.getBoolean(tess); + } catch (IllegalAccessException e) { + e.printStackTrace(); + return false; + } + } + @SuppressWarnings("unchecked") public static List<String> getTooltip(ItemStack aStack, boolean aGuiStyle) { 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(); + } + } +} |