aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMartin Robertz <dream-master@gmx.net>2020-02-17 07:16:53 +0100
committerGitHub <noreply@github.com>2020-02-17 07:16:53 +0100
commitb27e466de94ac1650707de92d90479cd20406831 (patch)
tree3b4b5389b6e1eb30458a2d051cabeb27a52ada08 /src/main/java
parentb7ce9db75baaf5a60b659fb565d4f9505f77e509 (diff)
parent0310080be0378bdae6994069285e619ec897ea80 (diff)
downloadGT5-Unofficial-b27e466de94ac1650707de92d90479cd20406831.tar.gz
GT5-Unofficial-b27e466de94ac1650707de92d90479cd20406831.tar.bz2
GT5-Unofficial-b27e466de94ac1650707de92d90479cd20406831.zip
Merge pull request #241 from GTNewHorizons/dont_blowup_on_bad_texture
Don't blowup on bad texture
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java37
1 files changed, 24 insertions, 13 deletions
diff --git a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
index d57aff8fc9..26e816a52c 100644
--- a/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
+++ b/src/main/java/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch.java
@@ -43,19 +43,30 @@ public abstract class GT_MetaTileEntity_Hatch extends GT_MetaTileEntity_BasicTan
@Override
public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, boolean aActive, boolean aRedstone) {
- int textureIndex=actualTexture|(mTexturePage<<7);//Shift seven since one page is 128 textures!
- int texturePointer=(byte)(actualTexture&0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside
- return aSide != aFacing ?
- textureIndex > 0 ?
- new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]} :
- new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]} :
- textureIndex > 0 ?
- aActive ?
- getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) :
- getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]) :
- aActive ?
- getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]) :
- getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ int textureIndex = actualTexture | (mTexturePage << 7);//Shift seven since one page is 128 textures!
+ int texturePointer = (byte) (actualTexture & 0x7F);//just to be sure, from my testing the 8th bit cannot be set clientside
+ try {
+ if (aSide != aFacing) {
+ if (textureIndex > 0)
+ return new ITexture[]{Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]};
+ else
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]};
+ } else {
+ if (textureIndex > 0) {
+ if (aActive)
+ return getTexturesActive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
+ else
+ return getTexturesInactive(Textures.BlockIcons.casingTexturePages[mTexturePage][texturePointer]);
+ } else {
+ if (aActive)
+ return getTexturesActive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ else
+ return getTexturesInactive(Textures.BlockIcons.MACHINE_CASINGS[mTier][aColorIndex + 1]);
+ }
+ }
+ } catch (NullPointerException npe) {
+ return new ITexture[]{Textures.BlockIcons.MACHINE_CASINGS[0][0]};
+ }
}
@Override