diff options
Diffstat (limited to 'src/Java/gregtech/api/enums')
-rw-r--r-- | src/Java/gregtech/api/enums/TAE.java | 63 |
1 files changed, 49 insertions, 14 deletions
diff --git a/src/Java/gregtech/api/enums/TAE.java b/src/Java/gregtech/api/enums/TAE.java index c6fc8c7790..248722269b 100644 --- a/src/Java/gregtech/api/enums/TAE.java +++ b/src/Java/gregtech/api/enums/TAE.java @@ -1,16 +1,22 @@ package gregtech.api.enums; +import java.lang.reflect.Field; + +import gregtech.api.enums.Textures.BlockIcons; import gregtech.api.interfaces.ITexture; import gregtech.api.objects.GT_CopiedBlockTexture; import gregtech.api.objects.GT_RenderedTexture; +import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.reflect.ReflectionUtils; public class TAE { //TAE stands for Texture Array Expansion. - + public static int gtTexturesArrayStartOrigin; - public static int gtPPLastUsedIndex = 96; + public static int gtPPLastUsedIndex = 64; + public static int secondaryIndex = 0; public static boolean hasArrayBeenExpanded = false; public static boolean hookGtTextures() { @@ -42,22 +48,51 @@ public class TAE { }*/ public static boolean registerTextures(GT_CopiedBlockTexture gt_CopiedBlockTexture) { - Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = gt_CopiedBlockTexture; - gtPPLastUsedIndex++; - //Just so I know registration is done. - return true; + try { + + //Handle page 2. + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + Field x = ReflectionUtils.getField(Textures.BlockIcons.class, "casingTexturePages"); + if (x != null) { + ITexture[][] h = (ITexture[][]) x.get(null); + if (h != null) { + h[64][secondaryIndex++] = gt_CopiedBlockTexture; + x.set(null, h); + return true; + } + } + } + } + + //set to page 1. + else { + Textures.BlockIcons.CASING_BLOCKS[gtPPLastUsedIndex] = gt_CopiedBlockTexture; + gtPPLastUsedIndex++; + return true; + } + } + catch (Throwable t) { + t.printStackTrace(); + } + return false; } - + public static ITexture getTexture(int index){ - if (!hasArrayBeenExpanded){ - return null; - } - else { - return Textures.BlockIcons.CASING_BLOCKS[(96+index)]; + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + return Textures.BlockIcons.CASING_BLOCKS[((64*128)+index)]; + } } + return Textures.BlockIcons.CASING_BLOCKS[(64+index)]; } - + public static int GTPP_INDEX(int ID){ - return (96+ID); + if (gtPPLastUsedIndex >= 128) { + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK && Utils.getGregtechSubVersion() > 30) { + return (ID); + } + } + return (64+ID); } } |