Fix a load of null issues, and get it to sort of work.
This commit is contained in:
parent
65e651f402
commit
528fecc2b5
35 changed files with 101 additions and 87 deletions
src/main/java/techreborn/items
|
@ -10,6 +10,6 @@ public abstract class ItemTextureBase extends ItemTR implements ITexturedItem {
|
|||
|
||||
@Override
|
||||
public ModelResourceLocation getModel(ItemStack stack, EntityPlayer player, int useRemaining) {
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5), "inventory");
|
||||
return new ModelResourceLocation(ModInfo.MOD_ID + ":" + getUnlocalizedName(stack).substring(5).toLowerCase(), "inventory");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ import net.minecraft.inventory.EntityEquipmentSlot;
|
|||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemArmor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.NonNullList;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
@ -68,7 +69,7 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) {
|
||||
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, NonNullList itemList) {
|
||||
ItemStack itemStack = new ItemStack(this, 1);
|
||||
itemList.add(itemStack);
|
||||
|
||||
|
@ -87,7 +88,7 @@ public class ItemLapotronPack extends ItemArmor implements IEnergyItemInfo, ITex
|
|||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
if (player.inventory.getStackInSlot(i) != ItemStack.EMPTY) {
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if (item.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
|
|
|
@ -38,7 +38,7 @@ public class ItemLithiumBatpack extends ItemArmor implements IEnergyItemInfo, IT
|
|||
@Override
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
for (int i = 0; i < player.inventory.getSizeInventory(); i++) {
|
||||
if (player.inventory.getStackInSlot(i) != null) {
|
||||
if (player.inventory.getStackInSlot(i) != ItemStack.EMPTY) {
|
||||
ItemStack item = player.inventory.getStackInSlot(i);
|
||||
if (item.getItem() instanceof IEnergyItemInfo) {
|
||||
IEnergyItemInfo energyItemInfo = (IEnergyItemInfo) item.getItem();
|
||||
|
|
|
@ -52,7 +52,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
World worldIn,
|
||||
@Nullable
|
||||
EntityLivingBase entityIn) {
|
||||
if (stack != null && stack.getTagCompound().getBoolean("isActive")) {
|
||||
if (stack != ItemStack.EMPTY && stack.getTagCompound().getBoolean("isActive")) {
|
||||
return 1.0F;
|
||||
}
|
||||
return 0.0F;
|
||||
|
@ -65,7 +65,7 @@ public class ItemNanosaber extends ItemSword implements IEnergyItemInfo {
|
|||
ItemStack stack) {
|
||||
Multimap<String, AttributeModifier> multimap = HashMultimap.<String, AttributeModifier>create();
|
||||
int modifier = 0;
|
||||
if (stack.getTagCompound().getBoolean("isActive"))
|
||||
if (!stack.isEmpty() && stack.getTagCompound().getBoolean("isActive"))
|
||||
modifier = 9;
|
||||
|
||||
if (slot == EntityEquipmentSlot.MAINHAND) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue