mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-28 07:55:41 +00:00
#1012 Crash with TE texture
This commit is contained in:
1 parent
d8e46394d7
commit
7d110ad811
1 file changed
+16
-6
@@ -3,10 +3,12 @@ package crazypants.enderio.machine.painter;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import cpw.mods.fml.client.registry.ISimpleBlockRenderingHandler;
|
||||
import crazypants.render.CubeRenderer;
|
||||
import crazypants.render.IconUtil;
|
||||
|
||||
public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
|
||||
@@ -44,13 +46,21 @@ public class PaintedBlockRenderer implements ISimpleBlockRenderingHandler {
|
||||
}
|
||||
|
||||
IBlockAccess origBa = rb.blockAccess;
|
||||
rb.blockAccess = new PaintedBlockAccessWrapper(origBa);
|
||||
if(srcBlk == block) {
|
||||
rb.renderStandardBlock(srcBlk, x, y, z);
|
||||
} else {
|
||||
rb.renderBlockByRenderType(srcBlk, x, y, z);
|
||||
try {
|
||||
rb.blockAccess = new PaintedBlockAccessWrapper(origBa);
|
||||
if(srcBlk == block) {
|
||||
rb.renderStandardBlock(srcBlk, x, y, z);
|
||||
} else {
|
||||
rb.renderBlockByRenderType(srcBlk, x, y, z);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//just in case the paint source wont render safely in this way
|
||||
rb.setOverrideBlockTexture(IconUtil.errorTexture);
|
||||
rb.renderStandardBlock(Blocks.stone, x, y, z);
|
||||
rb.setOverrideBlockTexture(null);
|
||||
} finally {
|
||||
rb.blockAccess = origBa;
|
||||
}
|
||||
rb.blockAccess = origBa;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user