Fixes #2558: Make Sky Stone Chest TESR more robust against odd world state, as Vanilla also does.
This commit is contained in:
@@ -19,6 +19,7 @@
|
|||||||
package appeng.client.render.tesr;
|
package appeng.client.render.tesr;
|
||||||
|
|
||||||
|
|
||||||
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.model.ModelChest;
|
import net.minecraft.client.model.ModelChest;
|
||||||
import net.minecraft.client.renderer.GlStateManager;
|
import net.minecraft.client.renderer.GlStateManager;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
@@ -70,14 +71,8 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if( te != null )
|
SkyChestType chestType = getChestType( te );
|
||||||
{
|
this.bindTexture( chestType == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
||||||
this.bindTexture( ( (BlockSkyChest) te.getBlockType() ).type == SkyChestType.STONE ? TEXTURE_STONE : TEXTURE_BLOCK );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
this.bindTexture( TEXTURE_BLOCK );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GlStateManager.pushMatrix();
|
GlStateManager.pushMatrix();
|
||||||
@@ -128,4 +123,20 @@ public class SkyChestTESR extends TileEntitySpecialRenderer<TileSkyChest>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Defensively determine the sky chest type
|
||||||
|
private static SkyChestType getChestType( TileSkyChest te )
|
||||||
|
{
|
||||||
|
if( te == null )
|
||||||
|
{
|
||||||
|
return SkyChestType.BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
|
Block blockType = te.getBlockType();
|
||||||
|
if( blockType instanceof BlockSkyChest )
|
||||||
|
{
|
||||||
|
return ( (BlockSkyChest) blockType ).type;
|
||||||
|
}
|
||||||
|
return SkyChestType.BLOCK;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user