|
38 | 38 | import cpw.mods.fml.common.FMLCommonHandler; |
39 | 39 | import cpw.mods.fml.common.Loader; |
40 | 40 | import cpw.mods.fml.common.eventhandler.SubscribeEvent; |
| 41 | + |
| 42 | +import it.unimi.dsi.fastutil.ints.IntArraySet; |
| 43 | +import it.unimi.dsi.fastutil.ints.IntSet; |
41 | 44 | import lombok.RequiredArgsConstructor; |
42 | 45 | import lombok.val; |
43 | 46 | import net.minecraft.block.Block; |
@@ -199,6 +202,8 @@ private static int doChunkUpdateForRenderPass(WorldRenderer wr, UpdateTask task, |
199 | 202 | return flags; |
200 | 203 | } |
201 | 204 |
|
| 205 | + private static final IntSet alreadyWarnedRenderTypes = new IntArraySet(); |
| 206 | + |
202 | 207 | private static int doChunkUpdateForRenderPassBlock(WorldRenderer wr, UpdateTask task, ChunkCache chunkcache, Tessellator tess, int pass, RenderBlocks renderblocks, int x, int y, int z, int flags) { |
203 | 208 | Block block = chunkcache.getBlock(x, y, z); |
204 | 209 |
|
@@ -230,7 +235,17 @@ private static int doChunkUpdateForRenderPassBlock(WorldRenderer wr, UpdateTask |
230 | 235 | tess.setTranslation(-wr.posX, -wr.posY, -wr.posZ); |
231 | 236 | } |
232 | 237 |
|
233 | | - flags |= renderblocks.renderBlockByRenderType(block, x, y, z) ? BIT_RenderedSomething : 0; |
| 238 | + try { |
| 239 | + flags |= renderblocks.renderBlockByRenderType(block, x, y, z) ? BIT_RenderedSomething : 0; |
| 240 | + } catch (Exception e) { |
| 241 | + synchronized (alreadyWarnedRenderTypes) { |
| 242 | + val rt = block.getRenderType(); |
| 243 | + if (!alreadyWarnedRenderTypes.contains(rt)) { |
| 244 | + alreadyWarnedRenderTypes.add(rt); |
| 245 | + Share.log.error("Exception while rendering a block!", e); |
| 246 | + } |
| 247 | + } |
| 248 | + } |
234 | 249 |
|
235 | 250 | if (block.getRenderType() == 0 && x == playerX && y == playerY && z == playerZ) { |
236 | 251 | renderblocks.setRenderFromInside(true); |
|
0 commit comments