Fix itemstack comparison with null

This commit is contained in:
mezz committed 2017-06-19 23:27:52 -07:00
1 parent a2749e4507
commit c6d7c7c11f
3 files changed
+4 -4

No files matched your search

@@ -5,7 +5,7 @@
ItemStack itemstack = abstractclientplayer.func_184607_cu();
- if (itemstack.func_77973_b() == Items.field_151031_f)
+ if (itemstack != null && itemstack.func_77973_b() == Items.field_151031_f) //Forge: Data watcher can desync and cause this to NPE...
+ if (!itemstack.func_190926_b() && itemstack.func_77973_b() == Items.field_151031_f) //Forge: Data watcher can desync and cause this to NPE...
{
EnumHand enumhand1 = abstractclientplayer.func_184600_cs();
flag = enumhand1 == EnumHand.MAIN_HAND;
@@ -191,7 +191,7 @@
public void func_184609_a(EnumHand p_184609_1_)
{
+ ItemStack stack = this.func_184586_b(p_184609_1_);
+ if (stack != null && stack.func_77973_b() != null)
+ if (!stack.func_190926_b())
+ {
+ if (stack.func_77973_b().onEntitySwing(this, stack)) return;
+ }
@@ -293,7 +293,7 @@
if (itemstack == this.field_184627_bm)
{
+ if (this.field_184627_bm != null)
+ if (!this.field_184627_bm.func_190926_b())
+ {
+ field_184628_bn = net.minecraftforge.event.ForgeEventFactory.onItemUseTick(this, field_184627_bm, field_184628_bn);
+ if (field_184628_bn > 0)
@@ -621,7 +621,7 @@ public class GuiIngameForge extends GuiIngame
{
mc.mcProfiler.startSection("toolHighlight");
if (this.remainingHighlightTicks > 0 && this.highlightingItemStack != null)
if (this.remainingHighlightTicks > 0 && !this.highlightingItemStack.isEmpty())
{
String name = this.highlightingItemStack.getDisplayName();
if (this.highlightingItemStack.hasDisplayName())