diff options
| author | Jason Mitchell <mitchej@gmail.com> | 2023-04-22 22:33:35 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-04-23 07:33:35 +0200 |
| commit | 56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b (patch) | |
| tree | 745e6d92025ec4ef449fc59fa5fdd741200b0489 /src/main/java/gregtech/common/render | |
| parent | ac0b7a7da46646d325def36eed811941dbfc5950 (diff) | |
| download | GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.gz GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.tar.bz2 GT5-Unofficial-56f2269f4af6d2130bdb2b6e6ac6e13bce89e47b.zip | |
Forge direction (#1895)
* ForgeDirection
Also refactor the clusterfuck that was `getCoordinateScan`
Co-authored by: Jason Mitchell <mitchej@gmail.com>
* Fix rendering of Frame Boxes
Frame boxes needed their own implementation of getTexture with int connexion mask,
which is returning an error texture for the MetaTileEntity, because pipes (FrameBox
**is** a pipe) do use this method to return different textures based on connexion
status.
---------
Co-authored-by: Léa Gris <lea.gris@noiraude.net>
Diffstat (limited to 'src/main/java/gregtech/common/render')
7 files changed, 267 insertions, 323 deletions
diff --git a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java index 421d2f648b..937c1a994f 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedBlockTexture.java @@ -14,10 +14,10 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I private final Block mBlock; private final byte mSide, mMeta; - protected GT_CopiedBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + protected GT_CopiedBlockTexture(Block aBlock, int ordinalSide, int aMeta, short[] aRGBa, boolean allowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedBlockTexture"); mBlock = aBlock; - mSide = (byte) aSide; + mSide = (byte) ordinalSide; mMeta = (byte) aMeta; } @@ -26,8 +26,8 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I return false; } - private IIcon getIcon(int aSide) { - if (mSide == 6) return mBlock.getIcon(aSide, mMeta); + private IIcon getIcon(int ordinalSide) { + if (mSide == 6) return mBlock.getIcon(ordinalSide, mMeta); return mBlock.getIcon(mSide, mMeta); } @@ -37,7 +37,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I aRenderer.field_152631_f = true; startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer).setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + .setupColor(ForgeDirection.EAST, 0xffffff); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; @@ -48,7 +48,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal()); new LightingHelper(aRenderer).setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + .setupColor(ForgeDirection.WEST, 0xffffff); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -58,7 +58,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.UP.ordinal()); new LightingHelper(aRenderer).setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + .setupColor(ForgeDirection.UP, 0xffffff); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -68,7 +68,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal()); new LightingHelper(aRenderer).setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), 0xffffff); + .setupColor(ForgeDirection.DOWN, 0xffffff); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -78,7 +78,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); final IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal()); new LightingHelper(aRenderer).setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + .setupColor(ForgeDirection.SOUTH, 0xffffff); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -89,7 +89,7 @@ public class GT_CopiedBlockTexture extends GT_TextureBase implements ITexture, I final IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal()); aRenderer.field_152631_f = true; new LightingHelper(aRenderer).setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + .setupColor(ForgeDirection.NORTH, 0xffffff); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; diff --git a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java index e4304af15d..17fa9ac8ff 100644 --- a/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java +++ b/src/main/java/gregtech/common/render/GT_CopiedCTMBlockTexture.java @@ -15,11 +15,11 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc private final Block mBlock; private final byte mSide, mMeta; - GT_CopiedCTMBlockTexture(Block aBlock, int aSide, int aMeta, short[] aRGBa, boolean allowAlpha) { + GT_CopiedCTMBlockTexture(Block aBlock, int ordinalSide, int aMeta, short[] aRGBa, boolean allowAlpha) { if (aRGBa.length != 4) throw new IllegalArgumentException("RGBa doesn't have 4 Values @ GT_CopiedCTMBlockTexture"); mBlock = aBlock; - mSide = (byte) aSide; + mSide = (byte) ordinalSide; mMeta = (byte) aMeta; } @@ -28,8 +28,8 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc return false; } - private IIcon getIcon(int aSide, int aX, int aY, int aZ, RenderBlocks aRenderer) { - final int tSide = mSide == 6 ? aSide : mSide; + private IIcon getIcon(int ordinalSide, int aX, int aY, int aZ, RenderBlocks aRenderer) { + final int tSide = mSide == 6 ? ordinalSide : mSide; return mBlock.getIcon(getBlockAccess(aRenderer), aX, aY, aZ, tSide); } @@ -43,7 +43,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc aRenderer.field_152631_f = true; startDrawingQuads(aRenderer, 1.0f, 0.0f, 0.0f); new LightingHelper(aRenderer).setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.EAST, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; @@ -54,7 +54,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, -1.0f, 0.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.WEST.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.WEST, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -64,7 +64,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, 1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.UP.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.UP, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -74,7 +74,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, -1.0f, 0.0f); final IIcon aIcon = getIcon(ForgeDirection.DOWN.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.DOWN, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -84,7 +84,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc startDrawingQuads(aRenderer, 0.0f, 0.0f, 1.0f); final IIcon aIcon = getIcon(ForgeDirection.SOUTH.ordinal(), aX, aY, aZ, aRenderer); new LightingHelper(aRenderer).setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.SOUTH, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); } @@ -95,7 +95,7 @@ class GT_CopiedCTMBlockTexture extends GT_TextureBase implements ITexture, IBloc final IIcon aIcon = getIcon(ForgeDirection.NORTH.ordinal(), aX, aY, aZ, aRenderer); aRenderer.field_152631_f = true; new LightingHelper(aRenderer).setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); + .setupColor(ForgeDirection.NORTH, mBlock.colorMultiplier(getBlockAccess(aRenderer), aX, aY, aZ)); aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); draw(aRenderer); aRenderer.field_152631_f = false; diff --git a/src/main/java/gregtech/common/render/GT_RenderUtil.java b/src/main/java/gregtech/common/render/GT_RenderUtil.java index 6cba823a66..e98f573b94 100644 --- a/src/main/java/gregtech/common/render/GT_RenderUtil.java +++ b/src/main/java/gregtech/common/render/GT_RenderUtil.java @@ -5,6 +5,7 @@ import net.minecraft.client.renderer.RenderBlocks; import net.minecraft.client.renderer.Tessellator; import net.minecraft.item.ItemStack; import net.minecraft.util.IIcon; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -23,31 +24,25 @@ public class GT_RenderUtil { } public static void renderBlockIcon(RenderBlocks aRenderer, Block aBlock, double aX, double aY, double aZ, - IIcon aIcon, byte aSide) { - switch (aSide) { - case 0 -> { + IIcon aIcon, ForgeDirection side) { + switch (side) { + case DOWN -> { aRenderer.renderFaceYNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 1 -> { + case UP -> { aRenderer.renderFaceYPos(aBlock, aX, aY, aZ, aIcon); - return; } - case 2 -> { + case NORTH -> { aRenderer.renderFaceZNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 3 -> { + case SOUTH -> { aRenderer.renderFaceZPos(aBlock, aX, aY, aZ, aIcon); - return; } - case 4 -> { + case WEST -> { aRenderer.renderFaceXNeg(aBlock, aX, aY, aZ, aIcon); - return; } - case 5 -> { + case EAST -> { aRenderer.renderFaceXPos(aBlock, aX, aY, aZ, aIcon); - return; } } } diff --git a/src/main/java/gregtech/common/render/GT_RenderedTexture.java b/src/main/java/gregtech/common/render/GT_RenderedTexture.java index 34b8c879ae..afaf3b290c 100644 --- a/src/main/java/gregtech/common/render/GT_RenderedTexture.java +++ b/src/main/java/gregtech/common/render/GT_RenderedTexture.java @@ -64,11 +64,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol if (enableAO) lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingXPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.EAST.ordinal(), mRGBa); + .setupColor(ForgeDirection.EAST, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.EAST.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.EAST, 0xffffff); renderFaceXPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -90,11 +90,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingXNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.WEST.ordinal(), mRGBa); + .setupColor(ForgeDirection.WEST, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.WEST.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.WEST, 0xffffff); renderFaceXNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -116,11 +116,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.UP.ordinal(), mRGBa); + .setupColor(ForgeDirection.UP, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.UP.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.UP, 0xffffff); renderFaceYPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -142,7 +142,7 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingYNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.DOWN.ordinal(), mRGBa); + .setupColor(ForgeDirection.DOWN, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceYNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { @@ -168,11 +168,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZPos(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.SOUTH.ordinal(), mRGBa); + .setupColor(ForgeDirection.SOUTH, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.SOUTH.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.SOUTH, 0xffffff); renderFaceZPos(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -194,11 +194,11 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol lighting.setBrightnessOverride(MAX_BRIGHTNESS); } lighting.setupLightingZNeg(aBlock, aX, aY, aZ) - .setupColor(ForgeDirection.NORTH.ordinal(), mRGBa); + .setupColor(ForgeDirection.NORTH, mRGBa); final ExtendedFacing rotation = getExtendedFacing(aX, aY, aZ); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getIcon(), rotation); if (mIconContainer.getOverlayIcon() != null) { - lighting.setupColor(ForgeDirection.NORTH.ordinal(), 0xffffff); + lighting.setupColor(ForgeDirection.NORTH, 0xffffff); renderFaceZNeg(aRenderer, aX, aY, aZ, mIconContainer.getOverlayIcon(), rotation); } aRenderer.enableAO = enableAO; @@ -383,9 +383,8 @@ public class GT_RenderedTexture extends GT_TextureBase implements ITexture, ICol alignment = ((IAlignmentProvider) meta).getAlignment(); } else if (meta != null) { return ExtendedFacing.of( - ForgeDirection.getOrientation( - meta.getBaseMetaTileEntity() - .getFrontFacing())); + meta.getBaseMetaTileEntity() + .getFrontFacing()); } } else if (te instanceof IAlignmentProvider) { alignment = ((IAlignmentProvider) te).getAlignment(); diff --git a/src/main/java/gregtech/common/render/GT_Renderer_Block.java b/src/main/java/gregtech/common/render/GT_Renderer_Block.java index 012115efa3..7ed875aa00 100644 --- a/src/main/java/gregtech/common/render/GT_Renderer_Block.java +++ b/src/main/java/gregtech/common/render/GT_Renderer_Block.java @@ -1,5 +1,11 @@ package gregtech.common.render; +import static gregtech.api.enums.GT_Values.SIDE_DOWN; +import static gregtech.api.enums.GT_Values.SIDE_EAST; +import static gregtech.api.enums.GT_Values.SIDE_NORTH; +import static gregtech.api.enums.GT_Values.SIDE_SOUTH; +import static gregtech.api.enums.GT_Values.SIDE_UP; +import static gregtech.api.enums.GT_Values.SIDE_WEST; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_DOWN; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_EAST; import static gregtech.api.interfaces.metatileentity.IConnectable.CONNECTED_NORTH; @@ -26,6 +32,7 @@ import net.minecraft.client.renderer.Tessellator; import net.minecraft.tileentity.TileEntity; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; import org.lwjgl.opengl.GL11; @@ -40,6 +47,7 @@ import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.interfaces.tileentity.IPipeRenderedTileEntity; import gregtech.api.interfaces.tileentity.ITexturedTileEntity; +import gregtech.api.metatileentity.MetaPipeEntity; import gregtech.api.objects.XSTR; import gregtech.common.blocks.GT_Block_Machines; import gregtech.common.blocks.GT_Block_Ores_Abstract; @@ -72,12 +80,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aZ, aBlock, aRenderer, - new ITexture[][] { ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) DOWN.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) UP.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) NORTH.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) SOUTH.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) WEST.ordinal()), - ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered((byte) EAST.ordinal()) }); + new ITexture[][] { ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(DOWN), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(UP), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(NORTH), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(SOUTH), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(WEST), + ((IPipeRenderedTileEntity) tTileEntity).getTextureCovered(EAST) }); } if ((tTileEntity instanceof ITexturedTileEntity)) { return renderStandardBlock( @@ -87,12 +95,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aZ, aBlock, aRenderer, - new ITexture[][] { ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) DOWN.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) UP.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) NORTH.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) SOUTH.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) WEST.ordinal()), - ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, (byte) EAST.ordinal()) }); + new ITexture[][] { ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, DOWN), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, UP), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, NORTH), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, SOUTH), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, WEST), + ((ITexturedTileEntity) tTileEntity).getTexture(aBlock, EAST) }); } return false; } @@ -102,12 +110,12 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { aBlock.setBlockBounds(blockMin, blockMin, blockMin, blockMax, blockMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[DOWN.ordinal()], true); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[UP.ordinal()], true); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[NORTH.ordinal()], true); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SOUTH.ordinal()], true); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[WEST.ordinal()], true); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[EAST.ordinal()], true); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_DOWN], true); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_UP], true); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_NORTH], true); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_SOUTH], true); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_WEST], true); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, aTextures[SIDE_EAST], true); return true; } @@ -126,65 +134,66 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { final float pipeMax = blockMax - pipeMin; final boolean[] tIsCovered = new boolean[VALID_DIRECTIONS.length]; for (int i = 0; i < VALID_DIRECTIONS.length; i++) { - tIsCovered[i] = (aTileEntity.getCoverIDAtSide((byte) i) != 0); + tIsCovered[i] = (aTileEntity.getCoverIDAtSide(ForgeDirection.getOrientation(i)) != 0); } final ITexture[][] tIcons = new ITexture[VALID_DIRECTIONS.length][]; final ITexture[][] tCovers = new ITexture[VALID_DIRECTIONS.length][]; - for (int i = 0; i < VALID_DIRECTIONS.length; i++) { - tCovers[i] = aTileEntity.getTexture(aBlock, (byte) i); - tIcons[i] = aTileEntity.getTextureUncovered((byte) i); + for (final ForgeDirection iSide : ForgeDirection.VALID_DIRECTIONS) { + final int iOrdinalSide = iSide.ordinal(); + tCovers[iOrdinalSide] = aTileEntity.getTexture(aBlock, iSide); + tIcons[iOrdinalSide] = aTileEntity.getTextureUncovered(iSide); } switch (aConnections) { case NO_CONNECTION -> { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } case CONNECTED_EAST | CONNECTED_WEST -> { // EAST - WEST Pipe Sides aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); // EAST - WEST Pipe Ends - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } case CONNECTED_DOWN | CONNECTED_UP -> { // UP - DOWN Pipe Sides aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, blockMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); // UP - DOWN Pipe Ends - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); } case CONNECTED_NORTH | CONNECTED_SOUTH -> { // NORTH - SOUTH Pipe Sides aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); // NORTH - SOUTH Pipe Ends - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } default -> { if ((aConnections & CONNECTED_WEST) == 0) { @@ -193,273 +202,273 @@ public class GT_Renderer_Block implements ISimpleBlockRenderingHandler { } else { aBlock.setBlockBounds(blockMin, pipeMin, pipeMin, pipeMin, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); if ((aConnections & CONNECTED_EAST) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMax, pipeMin, pipeMin, blockMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); } - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); if ((aConnections & CONNECTED_DOWN) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, blockMin, pipeMin, pipeMax, pipeMin, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); if ((aConnections & CONNECTED_UP) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMax, pipeMin, pipeMax, blockMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); - renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SOUTH.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); + renderPositiveZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_SOUTH], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); if ((aConnections & CONNECTED_NORTH) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMin, blockMin, pipeMax, pipeMax, pipeMin); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_UP], false); + renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_WEST], false); + renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_EAST], false); } - renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[NORTH.ordinal()], false); + renderNegativeZFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_NORTH], false); if ((aConnections & CONNECTED_SOUTH) == 0) { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMin, pipeMax, pipeMax, pipeMax); aRenderer.setRenderBoundsFromBlock(aBlock); } else { aBlock.setBlockBounds(pipeMin, pipeMin, pipeMax, pipeMax, pipeMax, blockMax); aRenderer.setRenderBoundsFromBlock(aBlock); - renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[DOWN.ordinal()], false); - renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[UP.ordinal()], false); - renderNegativeXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[WEST.ordinal()], false); - renderPositiveXFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[EAST.ordinal()], false); + renderNegativeYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SIDE_DOWN], false); + renderPositiveYFacing(aWorld, aRenderer, aBlock, aX, aY, aZ, tIcons[SID |
