More item fixes

- Living and Sentient armor have no armor models
- (Self) Sacrifice Pack have no armor models
This commit is contained in:
Nick 2016-03-18 12:45:37 -07:00
parent f95949a1c8
commit 34f5753b17
9 changed files with 75 additions and 176 deletions

View file

@ -12,33 +12,29 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.ai.attributes.AttributeModifier;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor; import net.minecraftforge.common.ISpecialArmor;
import net.minecraftforge.fml.common.Optional;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import thaumcraft.api.items.IGoggles;
import thaumcraft.api.items.IRevealer;
import thaumcraft.api.items.IRunicArmor;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Map.Entry; import java.util.Map.Entry;
@Optional.InterfaceList({ @Optional.Interface(iface = "thaumcraft.api.items.IRevealer", modid = "Thaumcraft"), @Optional.Interface(iface = "thaumcraft.api.items.IGoggles", modid = "Thaumcraft"), @Optional.Interface(iface = "thaumcraft.api.items.IRunicArmor", modid = "Thaumcraft") }) public class ItemLivingArmour extends ItemArmor implements ISpecialArmor
public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevealer, IGoggles, IRunicArmor
{ {
public static String[] names = { "helmet", "chest", "legs", "boots" }; public static String[] names = { "helmet", "chest", "legs", "boots" };
//TODO: Save/delete cache periodically. //TODO: Save/delete cache periodically.
public static Map<ItemStack, LivingArmour> armourMap = new HashMap<ItemStack, LivingArmour>(); public static Map<ItemStack, LivingArmour> armourMap = new HashMap<ItemStack, LivingArmour>();
public ItemLivingArmour(int armorType) public ItemLivingArmour(EntityEquipmentSlot armorType)
{ {
super(ItemArmor.ArmorMaterial.IRON, 0, armorType); super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
setUnlocalizedName(Constants.Mod.MODID + ".livingArmour."); setUnlocalizedName(Constants.Mod.MODID + ".livingArmour.");
@ -81,9 +77,9 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea
{ {
armourReduction = 0.24 / 0.64; // This values puts it at iron level armourReduction = 0.24 / 0.64; // This values puts it at iron level
ItemStack helmet = player.getEquipmentInSlot(4); ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
ItemStack leggings = player.getEquipmentInSlot(2); ItemStack leggings = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
ItemStack boots = player.getEquipmentInSlot(1); ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
if (helmet == null || leggings == null || boots == null) if (helmet == null || leggings == null || boots == null)
{ {
@ -193,23 +189,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea
super.addInformation(stack, player, tooltip, advanced); super.addInformation(stack, player, tooltip, advanced);
} }
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
if (this == ModItems.livingArmourChest || this == ModItems.livingArmourHelmet || this == ModItems.livingArmourBoots)
{
return "bloodmagic:models/armor/livingArmour_layer_1.png";
}
if (this == ModItems.livingArmourLegs)
{
return "bloodmagic:models/armor/livingArmour_layer_2.png";
} else
{
return null;
}
}
@Override @Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack) public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{ {
@ -242,7 +221,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea
} }
@Override @Override
public Multimap<String, AttributeModifier> getAttributeModifiers(ItemStack stack) public Multimap<String, AttributeModifier> getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack)
{ {
if (this == ModItems.livingArmourChest && isEnabled(stack)) if (this == ModItems.livingArmourChest && isEnabled(stack))
{ {
@ -251,13 +230,13 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea
return armour.getAttributeModifiers(); return armour.getAttributeModifiers();
} }
return super.getAttributeModifiers(stack); return super.getAttributeModifiers(slot, stack);
} }
@Override @Override
public String getUnlocalizedName(ItemStack stack) public String getUnlocalizedName(ItemStack stack)
{ {
return super.getUnlocalizedName(stack) + names[armorType]; return super.getUnlocalizedName(stack) + names[armorType.getIndex()];
} }
public static LivingArmour getLivingArmour(ItemStack stack) public static LivingArmour getLivingArmour(ItemStack stack)
@ -329,49 +308,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea
return null; return null;
} }
@Override
public boolean showIngamePopups(ItemStack stack, EntityLivingBase entityLivingBase)
{
stack = NBTHelper.checkNBT(stack);
LivingArmour armor = getLivingArmour(stack);
return armor.upgradeMap.containsKey(Constants.Mod.MODID + ".upgrade.revealing") && LivingArmour.hasFullSet((EntityPlayer) entityLivingBase);
}
@Override
public boolean showNodes(ItemStack stack, EntityLivingBase entityLivingBase)
{
stack = NBTHelper.checkNBT(stack);
LivingArmour armor = getLivingArmour(stack);
return armor.upgradeMap.containsKey(Constants.Mod.MODID + ".upgrade.revealing") && LivingArmour.hasFullSet((EntityPlayer) entityLivingBase);
}
@Override
public int getRunicCharge(ItemStack stack)
{
if (this == ModItems.livingArmourChest)
{
stack = NBTHelper.checkNBT(stack);
LivingArmour armour = getLivingArmour(stack);
int shielding = 0;
if (armour != null && isEnabled(stack))
{
for (Entry<String, LivingArmourUpgrade> entry : armour.upgradeMap.entrySet())
{
LivingArmourUpgrade upgrade = entry.getValue();
shielding += upgrade.getRunicShielding();
}
}
return shielding;
}
return 0;
}
public void setIsEnabled(ItemStack stack, boolean bool) public void setIsEnabled(ItemStack stack, boolean bool)
{ {
NBTHelper.checkNBT(stack); NBTHelper.checkNBT(stack);

View file

@ -6,10 +6,12 @@ import WayofTime.bloodmagic.api.soul.EnumDemonWillType;
import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler;
import WayofTime.bloodmagic.api.util.helper.NBTHelper; import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.registry.ModItems; import WayofTime.bloodmagic.registry.ModItems;
import net.minecraft.enchantment.Enchantment;
import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
@ -26,7 +28,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
{ {
public static String[] names = { "helmet", "chest", "legs", "boots" }; public static String[] names = { "helmet", "chest", "legs", "boots" };
public ItemSentientArmour(int armorType) public ItemSentientArmour(EntityEquipmentSlot armorType)
{ {
super(ItemArmor.ArmorMaterial.IRON, 0, armorType); super(ItemArmor.ArmorMaterial.IRON, 0, armorType);
setUnlocalizedName(Constants.Mod.MODID + ".sentientArmour."); setUnlocalizedName(Constants.Mod.MODID + ".sentientArmour.");
@ -74,9 +76,9 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
{ {
armourReduction = 0.24 / 0.64; // This values puts it at iron level armourReduction = 0.24 / 0.64; // This values puts it at iron level
ItemStack helmet = player.getEquipmentInSlot(4); ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD);
ItemStack leggings = player.getEquipmentInSlot(2); ItemStack leggings = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS);
ItemStack boots = player.getEquipmentInSlot(1); ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET);
if (helmet == null || leggings == null || boots == null) if (helmet == null || leggings == null || boots == null)
{ {
@ -158,42 +160,6 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
this.revertArmour(player, stack); this.revertArmour(player, stack);
} }
} }
return;
}
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List<String> tooltip, boolean advanced)
{
super.addInformation(stack, player, tooltip, advanced);
}
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
if (this == ModItems.sentientArmourChest || this == ModItems.sentientArmourHelmet || this == ModItems.sentientArmourBoots)
{
return "bloodmagic:models/armor/sentientArmour_layer_1.png";
}
if (this == ModItems.sentientArmourLegs)
{
return "bloodmagic:models/armor/sentientArmour_layer_2.png";
} else
{
return null;
}
}
@Override
public void onArmorTick(World world, EntityPlayer player, ItemStack stack)
{
super.onArmorTick(world, player, stack);
if (world.isRemote)
{
return;
}
} }
public double getCostModifier(ItemStack stack) public double getCostModifier(ItemStack stack)
@ -231,13 +197,13 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
@Override @Override
public String getUnlocalizedName(ItemStack stack) public String getUnlocalizedName(ItemStack stack)
{ {
return super.getUnlocalizedName(stack) + names[armorType]; return super.getUnlocalizedName(stack) + names[armorType.getIndex()];
} }
public void revertArmour(EntityPlayer player, ItemStack itemStack) public void revertArmour(EntityPlayer player, ItemStack itemStack)
{ {
ItemStack stack = this.getContainedArmourStack(itemStack); ItemStack stack = this.getContainedArmourStack(itemStack);
player.inventory.armorInventory[3 - this.armorType] = stack; player.inventory.armorInventory[3 - armorType.getIndex()] = stack;
} }
public static void revertAllArmour(EntityPlayer player) public static void revertAllArmour(EntityPlayer player)
@ -270,7 +236,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor
} }
omegaTag.setTag("armour", tag); omegaTag.setTag("armour", tag);
Map<Integer, Integer> enchantmentMap = EnchantmentHelper.getEnchantments(previousArmour); Map<Enchantment, Integer> enchantmentMap = EnchantmentHelper.getEnchantments(previousArmour);
EnchantmentHelper.setEnchantments(enchantmentMap, newArmour); EnchantmentHelper.setEnchantments(enchantmentMap, newArmour);
} }

View file

@ -1,12 +1,12 @@
package WayofTime.bloodmagic.item.block; package WayofTime.bloodmagic.item.block;
import WayofTime.bloodmagic.tile.TileBloodTank; import WayofTime.bloodmagic.tile.TileBloodTank;
import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem; import net.minecraftforge.fluids.IFluidContainerItem;
@ -32,18 +32,19 @@ public class ItemBlockBloodTank extends ItemBlock implements IFluidContainerItem
} }
} }
// TODO - Correctly localize these strings
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List<String> tooltip, boolean advanced) public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List<String> tooltip, boolean advanced)
{ {
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.capacity") + ": " + String.valueOf(getCapacity(stack)) + "mB"); tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.capacity") + ": " + String.valueOf(getCapacity(stack)) + "mB");
if (stack.hasTagCompound()) if (stack.hasTagCompound())
{ {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank"); NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank");
if (!tag.getString("FluidName").equals("")) if (!tag.getString("FluidName").equals(""))
{ {
tooltip.add(" "); tooltip.add(" ");
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.type") + ": " + tag.getString("FluidName")); tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.type") + ": " + tag.getString("FluidName"));
tooltip.add(StatCollector.translateToLocal("tooltip.BloodMagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + getCapacity(stack) + "mB"); tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + getCapacity(stack) + "mB");
} }
} }
} }

View file

@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class ItemBlockDemonCrystal extends ItemBlock public class ItemBlockDemonCrystal extends ItemBlock

View file

@ -7,12 +7,15 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -26,7 +29,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
public ItemPackSacrifice() public ItemPackSacrifice()
{ {
super(ArmorMaterial.CHAIN, 0, 1); super(ArmorMaterial.CHAIN, 0, EntityEquipmentSlot.CHEST);
setUnlocalizedName(Constants.Mod.MODID + ".pack.sacrifice"); setUnlocalizedName(Constants.Mod.MODID + ".pack.sacrifice");
setRegistryName(Constants.BloodMagicItem.SACRIFICE_PACK.getRegName()); setRegistryName(Constants.BloodMagicItem.SACRIFICE_PACK.getRegName());
@ -34,24 +37,24 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{ {
if (world.isRemote) if (world.isRemote)
return stack; return ActionResult.newResult(EnumActionResult.FAIL, stack);
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, false); RayTraceResult position = this.getMovingObjectPositionFromPlayer(world, player, false);
if (position == null) if (position == null)
{ {
return super.onItemRightClick(stack, world, player); return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
} else } else
{ {
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) if (position.typeOfHit == RayTraceResult.Type.BLOCK)
{ {
TileEntity tile = world.getTileEntity(position.getBlockPos()); TileEntity tile = world.getTileEntity(position.getBlockPos());
if (!(tile instanceof TileAltar)) if (!(tile instanceof TileAltar))
return super.onItemRightClick(stack, world, player); return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
TileAltar altar = (TileAltar) tile; TileAltar altar = (TileAltar) tile;
@ -64,13 +67,13 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
int filledAmount = altar.fillMainTank(amount); int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount; amount -= filledAmount;
setStoredLP(stack, amount); setStoredLP(stack, amount);
world.markBlockForUpdate(position.getBlockPos()); world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos()));
} }
} }
} }
} }
return stack; return ActionResult.newResult(EnumActionResult.FAIL, stack);
} }
@Override @Override
@ -80,12 +83,6 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I
setStoredLP(stack, CAPACITY); setStoredLP(stack, CAPACITY);
} }
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
return Constants.Mod.DOMAIN + "models/armor/bloodPack_layer_1.png";
}
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced)
{ {

View file

@ -8,12 +8,15 @@ import WayofTime.bloodmagic.api.util.helper.NetworkHelper;
import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.client.IVariantProvider;
import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.tile.TileAltar;
import WayofTime.bloodmagic.util.helper.TextHelper; import WayofTime.bloodmagic.util.helper.TextHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.EntityEquipmentSlot;
import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemArmor;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.MovingObjectPosition; import net.minecraft.util.ActionResult;
import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.world.World; import net.minecraft.world.World;
import org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.Pair; import org.apache.commons.lang3.tuple.Pair;
@ -34,7 +37,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
public ItemPackSelfSacrifice() public ItemPackSelfSacrifice()
{ {
super(ArmorMaterial.CHAIN, 0, 1); super(ArmorMaterial.CHAIN, 0, EntityEquipmentSlot.CHEST);
setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice"); setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice");
setRegistryName(Constants.BloodMagicItem.SELF_SACRIFICE_PACK.getRegName()); setRegistryName(Constants.BloodMagicItem.SELF_SACRIFICE_PACK.getRegName());
@ -42,24 +45,24 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
} }
@Override @Override
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) public ActionResult<ItemStack> onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand)
{ {
if (world.isRemote) if (world.isRemote)
return stack; return ActionResult.newResult(EnumActionResult.FAIL, stack);
MovingObjectPosition position = this.getMovingObjectPositionFromPlayer(world, player, false); RayTraceResult position = this.getMovingObjectPositionFromPlayer(world, player, false);
if (position == null) if (position == null)
{ {
return super.onItemRightClick(stack, world, player); return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
} else } else
{ {
if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) if (position.typeOfHit == RayTraceResult.Type.BLOCK)
{ {
TileEntity tile = world.getTileEntity(position.getBlockPos()); TileEntity tile = world.getTileEntity(position.getBlockPos());
if (!(tile instanceof TileAltar)) if (!(tile instanceof TileAltar))
return super.onItemRightClick(stack, world, player); return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND);
TileAltar altar = (TileAltar) tile; TileAltar altar = (TileAltar) tile;
@ -72,13 +75,13 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
int filledAmount = altar.fillMainTank(amount); int filledAmount = altar.fillMainTank(amount);
amount -= filledAmount; amount -= filledAmount;
setStoredLP(stack, amount); setStoredLP(stack, amount);
world.markBlockForUpdate(position.getBlockPos()); world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos()));
} }
} }
} }
} }
return stack; return ActionResult.newResult(EnumActionResult.FAIL, stack);
} }
@Override @Override
@ -99,12 +102,6 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato
setStoredLP(stack, CAPACITY); setStoredLP(stack, CAPACITY);
} }
@Override
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type)
{
return Constants.Mod.DOMAIN + "models/armor/bloodPack_layer_1.png";
}
@Override @Override
public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced) public void addInformation(ItemStack stack, EntityPlayer player, List<String> list, boolean advanced)
{ {

View file

@ -7,8 +7,8 @@ import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.text.ITextComponent;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.TextComponentString;
public class ItemInventory implements IInventory public class ItemInventory implements IInventory
{ {
@ -237,9 +237,9 @@ public class ItemInventory implements IInventory
} }
@Override @Override
public IChatComponent getDisplayName() public ITextComponent getDisplayName()
{ {
return new ChatComponentText(getName()); return new TextComponentString(getName());
} }
@Override @Override

View file

@ -7,7 +7,7 @@ import net.minecraft.util.EnumFacing;
public interface IItemFilterProvider public interface IItemFilterProvider
{ {
public IItemFilter getInputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection); IItemFilter getInputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection);
public IItemFilter getOutputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection); IItemFilter getOutputItemFilter(ItemStack stack, IInventory inventory, EnumFacing syphonDirection);
} }

View file

@ -14,8 +14,10 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.EnumActionResult;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
@ -51,11 +53,11 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
} }
@Override @Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ) public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand)
{ {
if (world.isRemote) if (world.isRemote)
{ {
return true; return EnumActionResult.SUCCESS;
} }
TileEntity tileHit = world.getTileEntity(pos); TileEntity tileHit = world.getTileEntity(pos);
@ -68,9 +70,9 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
{ {
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
ChatUtil.sendChat(player, "Removing contained location"); ChatUtil.sendChat(player, "Removing contained location");
return false; return EnumActionResult.FAIL;
} }
return false; return EnumActionResult.FAIL;
} }
IRoutingNode node = (IRoutingNode) tileHit; IRoutingNode node = (IRoutingNode) tileHit;
BlockPos containedPos = getBlockPos(stack); BlockPos containedPos = getBlockPos(stack);
@ -78,7 +80,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
{ {
this.setBlockPos(stack, pos); this.setBlockPos(stack, pos);
ChatUtil.sendChat(player, "Setting node location"); ChatUtil.sendChat(player, "Setting node location");
return true; return EnumActionResult.SUCCESS;
} else } else
{ {
TileEntity pastTile = world.getTileEntity(containedPos); TileEntity pastTile = world.getTileEntity(containedPos);
@ -99,7 +101,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
node.addConnection(containedPos); node.addConnection(containedPos);
ChatUtil.sendChat(player, "Linked node to master!"); ChatUtil.sendChat(player, "Linked node to master!");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} }
} else } else
{ {
@ -107,7 +109,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
node.addConnection(containedPos); node.addConnection(containedPos);
ChatUtil.sendChat(player, "Linked node to master!"); ChatUtil.sendChat(player, "Linked node to master!");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} }
} else if (node instanceof IMasterRoutingNode) } else if (node instanceof IMasterRoutingNode)
@ -124,7 +126,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
master.addNodeToList(pastNode); master.addNodeToList(pastNode);
ChatUtil.sendChat(player, "Linked node to master!"); ChatUtil.sendChat(player, "Linked node to master!");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} }
} else } else
{ {
@ -132,7 +134,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
pastNode.addConnection(pos); pastNode.addConnection(pos);
ChatUtil.sendChat(player, "Linked node to master!"); ChatUtil.sendChat(player, "Linked node to master!");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} }
} else } else
{ {
@ -152,7 +154,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
node.addConnection(containedPos); node.addConnection(containedPos);
ChatUtil.sendChat(player, "Linked nodes together."); ChatUtil.sendChat(player, "Linked nodes together.");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} else if (pastNode.getMasterPos().equals(BlockPos.ORIGIN)) //pastNode is not connected to a master, but node is } else if (pastNode.getMasterPos().equals(BlockPos.ORIGIN)) //pastNode is not connected to a master, but node is
{ {
TileEntity tile = world.getTileEntity(node.getMasterPos()); TileEntity tile = world.getTileEntity(node.getMasterPos());
@ -167,7 +169,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
node.addConnection(containedPos); node.addConnection(containedPos);
ChatUtil.sendChat(player, "Linked nodes together."); ChatUtil.sendChat(player, "Linked nodes together.");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} else if (node.getMasterPos().equals(BlockPos.ORIGIN)) //node is not connected to a master, but pastNode is } else if (node.getMasterPos().equals(BlockPos.ORIGIN)) //node is not connected to a master, but pastNode is
{ {
TileEntity tile = world.getTileEntity(pastNode.getMasterPos()); TileEntity tile = world.getTileEntity(pastNode.getMasterPos());
@ -182,17 +184,17 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi
node.addConnection(containedPos); node.addConnection(containedPos);
ChatUtil.sendChat(player, "Linked nodes together."); ChatUtil.sendChat(player, "Linked nodes together.");
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} else } else
{ {
this.setBlockPos(stack, BlockPos.ORIGIN); this.setBlockPos(stack, BlockPos.ORIGIN);
return true; return EnumActionResult.SUCCESS;
} }
} }
} }
} }
return false; return EnumActionResult.FAIL;
} }
@Override @Override