aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/gregtech/api/render/GT_MultiTexture.java
diff options
context:
space:
mode:
authorLéa Gris <lea.gris@noiraude.net>2021-05-08 22:31:58 +0200
committerLéa Gris <lea.gris@noiraude.net>2021-05-21 13:38:39 +0200
commit04468545985a4fed401d9b6626670e8af5938920 (patch)
tree1941b545ac1e07ea64a605911ca245b5e836d56d /src/main/java/gregtech/api/render/GT_MultiTexture.java
parent9fcbc16e436ef745d761cb934834d8070fb68a8c (diff)
downloadGT5-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_MultiTexture.java')
-rw-r--r--src/main/java/gregtech/api/render/GT_MultiTexture.java59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/main/java/gregtech/api/render/GT_MultiTexture.java b/src/main/java/gregtech/api/render/GT_MultiTexture.java
new file mode 100644
index 0000000000..907876cd29
--- /dev/null
+++ b/src/main/java/gregtech/api/render/GT_MultiTexture.java
@@ -0,0 +1,59 @@
+package gregtech.api.render;
+
+import gregtech.api.interfaces.ITexture;
+import net.minecraft.block.Block;
+import net.minecraft.client.renderer.RenderBlocks;
+
+/**
+ * Lets Multiple ITextures Render overlay over each other.
+ * <p/>
+ * I should have done this much earlier...
+ */
+public class GT_MultiTexture implements ITexture {
+ private final ITexture[] mTextures;
+
+ 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);
+ }
+
+ @Override
+ public boolean isValidTexture() {
+ return true;
+ }
+}