mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-25 14:34:22 +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,21 +1,22 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.ai.attributes.IAttributeInstance;
|
||||
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;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
@@ -278,13 +279,15 @@ public class ArmorExtended implements IInventory
|
||||
public void dropItems ()
|
||||
{
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
for (int i = 0; i < 4; ++i)
|
||||
if (player != null)
|
||||
{
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i]))
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i]))
|
||||
{
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -73,15 +74,17 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
public void loadNBTData (NBTTagCompound compound)
|
||||
{
|
||||
NBTTagCompound properties = (NBTTagCompound) compound.getTag(PROP_NAME);
|
||||
|
||||
this.armor.readFromNBT(properties);
|
||||
this.knapsack.readFromNBT(properties);
|
||||
this.beginnerManual = properties.getBoolean("beginnerManual");
|
||||
this.materialManual = properties.getBoolean("materialManual");
|
||||
this.smelteryManual = properties.getBoolean("smelteryManual");
|
||||
this.weaponryManual = properties.getBoolean("weaponryManual");
|
||||
this.battlesignBonus = properties.getBoolean("battlesignBonus");
|
||||
this.derpLevel = properties.getInteger("derpLevel");
|
||||
if (properties != null)
|
||||
{
|
||||
this.armor.readFromNBT(properties);
|
||||
this.knapsack.readFromNBT(properties);
|
||||
this.beginnerManual = properties.getBoolean("beginnerManual");
|
||||
this.materialManual = properties.getBoolean("materialManual");
|
||||
this.smelteryManual = properties.getBoolean("smelteryManual");
|
||||
this.weaponryManual = properties.getBoolean("weaponryManual");
|
||||
this.battlesignBonus = properties.getBoolean("battlesignBonus");
|
||||
this.derpLevel = properties.getInteger("derpLevel");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user