From a315acc50d8aec5a3284802ae9d8473a714dcaf6 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 8 Jul 2016 19:08:54 +0200 Subject: [PATCH] Fixed a bug with the game sometimes crashing when looking at a block with the manual in hand This should actually fix it. --- .../ellpeck/actuallyadditions/mod/event/ClientEvents.java | 8 ++------ .../ellpeck/actuallyadditions/mod/items/ItemBooklet.java | 2 +- 2 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java index 23c03fb91..1550e2a11 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/ClientEvents.java @@ -136,9 +136,7 @@ public class ClientEvents{ if(stack != null){ if(stack.getItem() instanceof IHudDisplay){ profiler.startSection("ItemHudDisplay"); - if(minecraft.theWorld != null){ - ((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution()); - } + ((IHudDisplay)stack.getItem()).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution()); profiler.endSection(); } } @@ -149,9 +147,7 @@ public class ClientEvents{ if(blockHit instanceof IHudDisplay){ profiler.startSection("BlockHudDisplay"); - if(minecraft.theWorld != null){ - ((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution()); - } + ((IHudDisplay)blockHit).displayHud(minecraft, player, stack, posHit, profiler, event.getResolution()); profiler.endSection(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index 9f7ad587e..6b2f70f4f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -98,7 +98,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ @Override public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ - if(posHit != null){ + if(posHit != null && posHit.getBlockPos() != null){ IBlockState state = minecraft.theWorld.getBlockState(posHit.getBlockPos()); Block block = state.getBlock(); if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){