diff options
author | Léa Gris <lea.gris@noiraude.net> | 2021-05-08 22:31:58 +0200 |
---|---|---|
committer | Léa Gris <lea.gris@noiraude.net> | 2021-05-21 13:38:39 +0200 |
commit | 04468545985a4fed401d9b6626670e8af5938920 (patch) | |
tree | 1941b545ac1e07ea64a605911ca245b5e836d56d /src/main/java/gregtech/api/render/GT_StdRenderedTexture.java | |
parent | 9fcbc16e436ef745d761cb934834d8070fb68a8c (diff) | |
download | GT5-Unofficial-04468545985a4fed401d9b6626670e8af5938920.tar.gz GT5-Unofficial-04468545985a4fed401d9b6626670e8af5938920.tar.bz2 GT5-Unofficial-04468545985a4fed401d9b6626670e8af5938920.zip |
fix(render): move new textures rendering to new package
Old textures rendering are kept in api/objects for backward compatibility.
The old textures rendering does not handle glow textures or independant
inventory tessellation. The old textures will only work with the old
GT_Renderer_Block class
New textures rendering with own tessellation in inventory and handling
of glow emisssive textures are moved to the api/render package. These must
not be used with the Old GT_Renderer_Block class or
it will crash with: Already Tessellating Exception from the Tessellator class
Diffstat (limited to 'src/main/java/gregtech/api/render/GT_StdRenderedTexture.java')
-rw-r--r-- | src/main/java/gregtech/api/render/GT_StdRenderedTexture.java | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/render/GT_StdRenderedTexture.java b/src/main/java/gregtech/api/render/GT_StdRenderedTexture.java new file mode 100644 index 0000000000..9337ff59af --- /dev/null +++ b/src/main/java/gregtech/api/render/GT_StdRenderedTexture.java @@ -0,0 +1,45 @@ +package gregtech.api.render; + +import gregtech.api.enums.Dyes; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.util.LightingHelper; +import net.minecraft.block.Block; +import net.minecraft.client.renderer.RenderBlocks; +import net.minecraftforge.common.util.ForgeDirection; + +/** + * This ITexture implementation extends the GT_RenderedTexture class + * to render with bottom side flipped as with dumb blocks rendering. + * It is used in Ore blocks rendering so they better blends with dumb block ores + * from vanilla or other mods, when seen from bottom. + */ +public class GT_StdRenderedTexture extends GT_RenderedTexture{ + + @SuppressWarnings("unused") + public GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean aAllowAlpha) { + super(aIcon, aRGBa, aAllowAlpha); + } + + public GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa) { + super(aIcon, aRGBa, true); + } + + @SuppressWarnings("unused") + public GT_StdRenderedTexture(IIconContainer aIcon) { + super(aIcon, Dyes._NULL.mRGBa); + } + + @Override + public void renderYNeg(RenderBlocks aRenderer, Block aBlock, int aX, int aY, int aZ) { + startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); + LightingHelper lighting = new LightingHelper(aRenderer); + lighting.setupLightingYNeg(aBlock, aX, aY, aZ) + .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getIcon()); + if (mIconContainer.getOverlayIcon() != null) { + lighting.setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, mIconContainer.getOverlayIcon()); + } + draw(aRenderer); + } +} |