mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-20 12:19:48 +00:00
Fixed a lot of NPE's and few duplication glitches
(cherry-pick from other fork)
This commit is contained in:
1 parent
cae72b2db6
commit
6bd68f13b1
12 files changed
+292
-162
No files matched your search
@@ -1,16 +1,17 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.ArrayList;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.*;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class KnapsackInventory implements IInventory
|
||||
{
|
||||
@@ -166,12 +167,15 @@ public class KnapsackInventory implements IInventory
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
if (player != null)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -179,12 +183,16 @@ public class KnapsackInventory implements IInventory
|
||||
public void unequipItems ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
dropItemEntity(player, inventory[i]);
|
||||
this.inventory[i] = null;
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
dropItemEntity(player, inventory[i]);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user