diff options
author | Jason Mitchell <mitchej@gmail.com> | 2022-07-29 10:23:45 -0700 |
---|---|---|
committer | Jason Mitchell <mitchej+github@gmail.com> | 2022-08-26 07:42:48 -0700 |
commit | eb95711aadb0066e70440111f93167f6164e6da8 (patch) | |
tree | 2aeb301130661e382d0f8a02a861ec66c9bc243d /src/main/java/gregtech/common | |
parent | 68619f5c654f8a44f499f79b859a26787d778a18 (diff) | |
download | GT5-Unofficial-eb95711aadb0066e70440111f93167f6164e6da8.tar.gz GT5-Unofficial-eb95711aadb0066e70440111f93167f6164e6da8.tar.bz2 GT5-Unofficial-eb95711aadb0066e70440111f93167f6164e6da8.zip |
WIP Texture support
Diffstat (limited to 'src/main/java/gregtech/common')
4 files changed, 28 insertions, 4 deletions
diff --git a/src/main/java/gregtech/common/render/GT_IconFlipped.java b/src/main/java/gregtech/common/render/GT_IconFlipped.java index c3eee2900f..d4f96fed4f 100644 --- a/src/main/java/gregtech/common/render/GT_IconFlipped.java +++ b/src/main/java/gregtech/common/render/GT_IconFlipped.java @@ -11,6 +11,8 @@ public class GT_IconFlipped implements IIcon { private final boolean flipV; public GT_IconFlipped(IIcon baseIcon, boolean flipU, boolean flipV) { + if(baseIcon == null) + System.out.println("HI"); this.baseIcon = baseIcon; this.flipU = flipU; this.flipV = flipV; @@ -19,6 +21,7 @@ public class GT_IconFlipped implements IIcon { /** * Returns the width of the icon, in pixels. */ + @Override public int getIconWidth() { return this.baseIcon.getIconWidth(); } @@ -26,6 +29,7 @@ public class GT_IconFlipped implements IIcon { /** * Returns the height of the icon, in pixels. */ + @Override public int getIconHeight() { return this.baseIcon.getIconHeight(); } @@ -33,6 +37,7 @@ public class GT_IconFlipped implements IIcon { /** * Returns the minimum U coordinate to use when rendering with this icon. */ + @Override public float getMinU() { return this.flipU ? this.baseIcon.getMaxU() : this.baseIcon.getMinU(); } @@ -40,6 +45,7 @@ public class GT_IconFlipped implements IIcon { /** * Returns the maximum U coordinate to use when rendering with this icon. */ + @Override public float getMaxU() { return this.flipU ? this.baseIcon.getMinU() : this.baseIcon.getMaxU(); } @@ -47,14 +53,16 @@ public class GT_IconFlipped implements IIcon { /** * Gets a U coordinate on the icon. 0 returns uMin and 16 returns uMax. Other arguments return in-between values. */ + @Override public float getInterpolatedU(double p_94214_1_) { - float f = this.getMaxU() - this.getMinU(); + final float f = this.getMaxU() - this.getMinU(); return this.getMinU() + f * ((float) p_94214_1_ / 16.0F); } /** * Returns the minimum V coordinate to use when rendering with this icon. */ + @Override public float getMinV() { return this.flipV ? this.baseIcon.getMaxV() : this.baseIcon.getMinV(); } @@ -62,6 +70,7 @@ public class GT_IconFlipped implements IIcon { /** * Returns the maximum V coordinate to use when rendering with this icon. */ + @Override public float getMaxV() { return this.flipV ? this.baseIcon.getMinV() : this.baseIcon.getMaxV(); } @@ -69,12 +78,14 @@ public class GT_IconFlipped implements IIcon { /** * Gets a V coordinate on the icon. 0 returns vMin and 16 returns vMax. Other arguments return in-between values. */ + @Override public float getInterpolatedV(double p_94207_1_) { - float f = this.getMaxV() - this.getMinV(); + final float f = this.getMaxV() - this.getMinV(); return this.getMinV() + f * ((float) p_94207_1_ / 16.0F); } + @Override public String getIconName() { return this.baseIcon.getIconName(); } -}
\ No newline at end of file +} diff --git a/src/main/java/gregtech/common/render/GT_MultiTexture.java b/src/main/java/gregtech/common/render/GT_MultiTexture.java index b72a6b1953..2d78b9b988 100644 --- a/src/main/java/gregtech/common/render/GT_MultiTexture.java +++ b/src/main/java/gregtech/common/render/GT_MultiTexture.java @@ -1,5 +1,6 @@ package gregtech.common.render; +import gregtech.GT_Mod; import gregtech.api.interfaces.ITexture; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderBlocks; @@ -11,6 +12,12 @@ import net.minecraft.client.renderer.RenderBlocks; public class GT_MultiTexture extends GT_TextureBase implements ITexture { protected final ITexture[] mTextures; + + public static GT_MultiTexture get(ITexture... aTextures) { + return GT_Mod.instance.isClientSide() ? new GT_MultiTexture(aTextures) : null; + } + + protected GT_MultiTexture(ITexture... aTextures) { mTextures = aTextures; } diff --git a/src/main/java/gregtech/common/render/GT_TextureBuilder.java b/src/main/java/gregtech/common/render/GT_TextureBuilder.java index f79e438dd7..708720ad40 100644 --- a/src/main/java/gregtech/common/render/GT_TextureBuilder.java +++ b/src/main/java/gregtech/common/render/GT_TextureBuilder.java @@ -139,7 +139,7 @@ public class GT_TextureBuilder implements ITextureBuilder { private static Boolean apply(Block b, Byte m) { Class<?> clazz = b.getClass(); while (clazz != Block.class) { - String className = clazz.getName(); + final String className = clazz.getName(); if (GT_Values.mCTMDisabledBlock.contains(className)) return false; if (GT_Values.mCTMEnabledBlock.contains(className)) return true; clazz = clazz.getSuperclass(); diff --git a/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java b/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java index d470518842..23a2a484d1 100644 --- a/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java +++ b/src/main/java/gregtech/common/tileentities/machines/multiblock/MultiBlock_Macerator.java @@ -8,6 +8,7 @@ import gregtech.api.multitileentity.multiblock.base.MultiBlockPart; import gregtech.api.multitileentity.multiblock.base.MultiBlock_Stackable; import gregtech.api.render.TextureFactory; import gregtech.api.util.GT_Multiblock_Tooltip_Builder; +import gregtech.common.render.GT_MultiTexture; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; @@ -117,13 +118,18 @@ public class MultiBlock_Macerator extends MultiBlock_Stackable<MultiBlock_Macera @Override public ITexture[] getTexture(Block aBlock, byte aSide, boolean isActive, int aRenderPass) { + // TODO: MTE(Texture) if(mFacing == aSide) { return new ITexture[]{ + // Base Texture MACHINE_CASINGS[1][0], + // Active TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE).extFacing().build(), + // Active Glow TextureFactory.builder().addIcon(OVERLAY_FRONT_ELECTRIC_BLAST_FURNACE_ACTIVE_GLOW).extFacing().glow().build() }; } + // Base Texture return new ITexture[]{ MACHINE_CASINGS[1][0]}; } |