aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
diff options
context:
space:
mode:
authorLéa Gris <lea.gris@noiraude.net>2021-05-20 22:57:12 +0200
committerLéa Gris <lea.gris@noiraude.net>2021-05-21 13:41:21 +0200
commit678c9a6e1e7a3a1127c40ae5c3dda7ef4519bfb7 (patch)
treef275c84399e59b714bcd9a70f0ffa6d6020f5ffe /src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
parent04468545985a4fed401d9b6626670e8af5938920 (diff)
downloadGT5-Unofficial-678c9a6e1e7a3a1127c40ae5c3dda7ef4519bfb7.tar.gz
GT5-Unofficial-678c9a6e1e7a3a1127c40ae5c3dda7ef4519bfb7.tar.bz2
GT5-Unofficial-678c9a6e1e7a3a1127c40ae5c3dda7ef4519bfb7.zip
feat(render): implementation-free api texture factory
Provides an implementation-free API Texture factory an builder. Deprecates gregtech.api.objects.GT_*Texture.java classes Once all GregTech add-on will be migrated to the new implemnetation-free API, changes to the implementation will not affect the add-on. For now, this API allow rendering of in-world glow textures. In-inventory/hand rendering of glow texture require implementation changes that are postponed until no add-on uses the deprecated embedded implementation API.
Diffstat (limited to 'src/main/java/gregtech/common/render/GT_StdRenderedTexture.java')
-rw-r--r--src/main/java/gregtech/common/render/GT_StdRenderedTexture.java36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java b/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
new file mode 100644
index 0000000000..ba0f9d3a91
--- /dev/null
+++ b/src/main/java/gregtech/common/render/GT_StdRenderedTexture.java
@@ -0,0 +1,36 @@
+package gregtech.common.render;
+
+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.
+ */
+class GT_StdRenderedTexture extends GT_RenderedTexture{
+
+ GT_StdRenderedTexture(IIconContainer aIcon, short[] aRGBa, boolean allowAlpha) {
+ super(aIcon, aRGBa, allowAlpha);
+ }
+
+ @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);
+ LightingHelper lighting = new LightingHelper(aRenderer);
+ lighting.setupLightingYNeg(aBlock, aX, aY, aZ)
+ .setupColor(ForgeDirection.DOWN.ordinal(), getRGBA());
+ 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());
+ }
+ // TODO: Uncomment this once all addons have migrated to the new Texture API
+ //draw(aRenderer);
+ }
+}