Skip to content

Commit

Permalink
Fix trying to doublespawn knapsack and extended armor inventory on de…
Browse files Browse the repository at this point in the history
…ath. Fixes #988.
  • Loading branch information
Qowyn committed Sep 20, 2014
1 parent 263efb8 commit ceb08f9
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
7 changes: 4 additions & 3 deletions src/main/java/tconstruct/armor/player/ArmorExtended.java
Expand Up @@ -238,18 +238,19 @@ public void readFromNBT (NBTTagCompound tagCompound)
}
}

public void dropItems (ArrayList<EntityItem> drops)
public void dropItems ()
{
EntityPlayer player = parent.get();
player.captureDrops = true;
for (int i = 0; i < 4; ++i)
{
if (this.inventory[i] != null)
{
EntityItem entityItem = player.func_146097_a(this.inventory[i], true, false);
drops.add(entityItem);
player.func_146097_a(this.inventory[i], true, false);
this.inventory[i] = null;
}
}
player.captureDrops = false;
}

@Override
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/tconstruct/armor/player/KnapsackInventory.java
Expand Up @@ -158,18 +158,19 @@ public void readFromNBT (NBTTagCompound tagCompound)
}
}

public void dropItems (ArrayList<EntityItem> drops)
public void dropItems ()
{
EntityPlayer player = parent.get();
player.captureDrops = true;
for (int i = 0; i < inventory.length; ++i)
{
if (this.inventory[i] != null)
{
EntityItem entityItem = player.func_146097_a(this.inventory[i], true, false);
drops.add(entityItem);
player.func_146097_a(this.inventory[i], true, false);
this.inventory[i] = null;
}
}
player.captureDrops = false;
}

public void unequipItems ()
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/tconstruct/armor/player/TPlayerHandler.java
Expand Up @@ -261,8 +261,8 @@ public void playerDrops (PlayerDropsEvent evt)
else
stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();

stats.armor.dropItems(evt.drops);
stats.knapsack.dropItems(evt.drops);
stats.armor.dropItems();
stats.knapsack.dropItems();

playerStats.put(evt.entityPlayer.getPersistentID(), stats);
}
Expand Down

0 comments on commit ceb08f9

Please sign in to comment.