diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java index 1f8e81bc..df6207d7 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemLivingArmour.java @@ -12,33 +12,29 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.DamageSource; import net.minecraft.world.World; import net.minecraftforge.common.ISpecialArmor; -import net.minecraftforge.fml.common.Optional; import net.minecraftforge.fml.relauncher.Side; 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.List; import java.util.Map; 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, IRevealer, IGoggles, IRunicArmor +public class ItemLivingArmour extends ItemArmor implements ISpecialArmor { public static String[] names = { "helmet", "chest", "legs", "boots" }; //TODO: Save/delete cache periodically. public static Map armourMap = new HashMap(); - public ItemLivingArmour(int armorType) + public ItemLivingArmour(EntityEquipmentSlot armorType) { super(ItemArmor.ArmorMaterial.IRON, 0, armorType); 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 - ItemStack helmet = player.getEquipmentInSlot(4); - ItemStack leggings = player.getEquipmentInSlot(2); - ItemStack boots = player.getEquipmentInSlot(1); + ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD); + ItemStack leggings = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); + ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); 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); } - @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 public void onArmorTick(World world, EntityPlayer player, ItemStack stack) { @@ -242,7 +221,7 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea } @Override - public Multimap getAttributeModifiers(ItemStack stack) + public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack) { if (this == ModItems.livingArmourChest && isEnabled(stack)) { @@ -251,13 +230,13 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea return armour.getAttributeModifiers(); } - return super.getAttributeModifiers(stack); + return super.getAttributeModifiers(slot, stack); } @Override public String getUnlocalizedName(ItemStack stack) { - return super.getUnlocalizedName(stack) + names[armorType]; + return super.getUnlocalizedName(stack) + names[armorType.getIndex()]; } public static LivingArmour getLivingArmour(ItemStack stack) @@ -329,49 +308,6 @@ public class ItemLivingArmour extends ItemArmor implements ISpecialArmor, IRevea 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 entry : armour.upgradeMap.entrySet()) - { - LivingArmourUpgrade upgrade = entry.getValue(); - shielding += upgrade.getRunicShielding(); - } - } - - return shielding; - } - - return 0; - } - public void setIsEnabled(ItemStack stack, boolean bool) { NBTHelper.checkNBT(stack); diff --git a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java index 044746b3..3310cf0f 100644 --- a/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java +++ b/src/main/java/WayofTime/bloodmagic/item/armour/ItemSentientArmour.java @@ -6,10 +6,12 @@ import WayofTime.bloodmagic.api.soul.EnumDemonWillType; import WayofTime.bloodmagic.api.soul.PlayerDemonWillHandler; import WayofTime.bloodmagic.api.util.helper.NBTHelper; import WayofTime.bloodmagic.registry.ModItems; +import net.minecraft.enchantment.Enchantment; import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; 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 ItemSentientArmour(int armorType) + public ItemSentientArmour(EntityEquipmentSlot armorType) { super(ItemArmor.ArmorMaterial.IRON, 0, armorType); 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 - ItemStack helmet = player.getEquipmentInSlot(4); - ItemStack leggings = player.getEquipmentInSlot(2); - ItemStack boots = player.getEquipmentInSlot(1); + ItemStack helmet = player.getItemStackFromSlot(EntityEquipmentSlot.HEAD); + ItemStack leggings = player.getItemStackFromSlot(EntityEquipmentSlot.LEGS); + ItemStack boots = player.getItemStackFromSlot(EntityEquipmentSlot.FEET); if (helmet == null || leggings == null || boots == null) { @@ -158,42 +160,6 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor this.revertArmour(player, stack); } } - return; - } - - @Override - @SideOnly(Side.CLIENT) - public void addInformation(ItemStack stack, EntityPlayer player, List 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) @@ -231,13 +197,13 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor @Override 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) { 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) @@ -270,7 +236,7 @@ public class ItemSentientArmour extends ItemArmor implements ISpecialArmor } omegaTag.setTag("armour", tag); - Map enchantmentMap = EnchantmentHelper.getEnchantments(previousArmour); + Map enchantmentMap = EnchantmentHelper.getEnchantments(previousArmour); EnchantmentHelper.setEnchantments(enchantmentMap, newArmour); } diff --git a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockBloodTank.java b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockBloodTank.java index 29bce32c..6be26f0f 100644 --- a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockBloodTank.java +++ b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockBloodTank.java @@ -1,12 +1,12 @@ package WayofTime.bloodmagic.item.block; import WayofTime.bloodmagic.tile.TileBloodTank; +import WayofTime.bloodmagic.util.helper.TextHelper; import net.minecraft.block.Block; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.StatCollector; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.IFluidContainerItem; @@ -32,18 +32,19 @@ public class ItemBlockBloodTank extends ItemBlock implements IFluidContainerItem } } + // TODO - Correctly localize these strings @Override public void addInformation(ItemStack stack, EntityPlayer entityPlayer, List 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()) { NBTTagCompound tag = stack.getTagCompound().getCompoundTag("tank"); if (!tag.getString("FluidName").equals("")) { tooltip.add(" "); - tooltip.add(StatCollector.translateToLocal("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.type") + ": " + tag.getString("FluidName")); + tooltip.add(TextHelper.localizeEffect("tooltip.BloodMagic.fluid.amount") + ": " + tag.getInteger("Amount") + "/" + getCapacity(stack) + "mB"); } } } diff --git a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockDemonCrystal.java b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockDemonCrystal.java index d9e7a60b..b2cb959d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockDemonCrystal.java +++ b/src/main/java/WayofTime/bloodmagic/item/block/ItemBlockDemonCrystal.java @@ -8,8 +8,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemBlockDemonCrystal extends ItemBlock diff --git a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java index aa3ee5d4..ee74b10b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSacrifice.java @@ -7,12 +7,15 @@ import WayofTime.bloodmagic.api.util.helper.NBTHelper; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.helper.TextHelper; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; 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 org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -26,7 +29,7 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I public ItemPackSacrifice() { - super(ArmorMaterial.CHAIN, 0, 1); + super(ArmorMaterial.CHAIN, 0, EntityEquipmentSlot.CHEST); setUnlocalizedName(Constants.Mod.MODID + ".pack.sacrifice"); setRegistryName(Constants.BloodMagicItem.SACRIFICE_PACK.getRegName()); @@ -34,24 +37,24 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { 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) { - return super.onItemRightClick(stack, world, player); + return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND); } else { - if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (position.typeOfHit == RayTraceResult.Type.BLOCK) { TileEntity tile = world.getTileEntity(position.getBlockPos()); if (!(tile instanceof TileAltar)) - return super.onItemRightClick(stack, world, player); + return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND); TileAltar altar = (TileAltar) tile; @@ -64,13 +67,13 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; setStoredLP(stack, amount); - world.markBlockForUpdate(position.getBlockPos()); + world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos())); } } } } - return stack; + return ActionResult.newResult(EnumActionResult.FAIL, stack); } @Override @@ -80,12 +83,6 @@ public class ItemPackSacrifice extends ItemArmor implements IAltarManipulator, I 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 public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { diff --git a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java index 58c50753..52bb551b 100644 --- a/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java +++ b/src/main/java/WayofTime/bloodmagic/item/gear/ItemPackSelfSacrifice.java @@ -8,12 +8,15 @@ import WayofTime.bloodmagic.api.util.helper.NetworkHelper; import WayofTime.bloodmagic.client.IVariantProvider; import WayofTime.bloodmagic.tile.TileAltar; import WayofTime.bloodmagic.util.helper.TextHelper; -import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; 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 org.apache.commons.lang3.tuple.ImmutablePair; import org.apache.commons.lang3.tuple.Pair; @@ -34,7 +37,7 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato public ItemPackSelfSacrifice() { - super(ArmorMaterial.CHAIN, 0, 1); + super(ArmorMaterial.CHAIN, 0, EntityEquipmentSlot.CHEST); setUnlocalizedName(Constants.Mod.MODID + ".pack.selfSacrifice"); setRegistryName(Constants.BloodMagicItem.SELF_SACRIFICE_PACK.getRegName()); @@ -42,24 +45,24 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand) { 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) { - return super.onItemRightClick(stack, world, player); + return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND); } else { - if (position.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) + if (position.typeOfHit == RayTraceResult.Type.BLOCK) { TileEntity tile = world.getTileEntity(position.getBlockPos()); if (!(tile instanceof TileAltar)) - return super.onItemRightClick(stack, world, player); + return super.onItemRightClick(stack, world, player, EnumHand.MAIN_HAND); TileAltar altar = (TileAltar) tile; @@ -72,13 +75,13 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato int filledAmount = altar.fillMainTank(amount); amount -= filledAmount; setStoredLP(stack, amount); - world.markBlockForUpdate(position.getBlockPos()); + world.setBlockState(position.getBlockPos(), world.getBlockState(position.getBlockPos())); } } } } - return stack; + return ActionResult.newResult(EnumActionResult.FAIL, stack); } @Override @@ -99,12 +102,6 @@ public class ItemPackSelfSacrifice extends ItemArmor implements IAltarManipulato 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 public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean advanced) { diff --git a/src/main/java/WayofTime/bloodmagic/item/inventory/ItemInventory.java b/src/main/java/WayofTime/bloodmagic/item/inventory/ItemInventory.java index e682ba99..88fbdeff 100644 --- a/src/main/java/WayofTime/bloodmagic/item/inventory/ItemInventory.java +++ b/src/main/java/WayofTime/bloodmagic/item/inventory/ItemInventory.java @@ -7,8 +7,8 @@ import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; public class ItemInventory implements IInventory { @@ -237,9 +237,9 @@ public class ItemInventory implements IInventory } @Override - public IChatComponent getDisplayName() + public ITextComponent getDisplayName() { - return new ChatComponentText(getName()); + return new TextComponentString(getName()); } @Override diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/IItemFilterProvider.java b/src/main/java/WayofTime/bloodmagic/item/routing/IItemFilterProvider.java index 70869151..ec84ed57 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/IItemFilterProvider.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/IItemFilterProvider.java @@ -7,7 +7,7 @@ import net.minecraft.util.EnumFacing; 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); } diff --git a/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java b/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java index e1f2cfbd..a258e35d 100644 --- a/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java +++ b/src/main/java/WayofTime/bloodmagic/item/routing/ItemNodeRouter.java @@ -14,8 +14,10 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -51,11 +53,11 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi } @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) { - return true; + return EnumActionResult.SUCCESS; } TileEntity tileHit = world.getTileEntity(pos); @@ -68,9 +70,9 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi { this.setBlockPos(stack, BlockPos.ORIGIN); ChatUtil.sendChat(player, "Removing contained location"); - return false; + return EnumActionResult.FAIL; } - return false; + return EnumActionResult.FAIL; } IRoutingNode node = (IRoutingNode) tileHit; BlockPos containedPos = getBlockPos(stack); @@ -78,7 +80,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi { this.setBlockPos(stack, pos); ChatUtil.sendChat(player, "Setting node location"); - return true; + return EnumActionResult.SUCCESS; } else { TileEntity pastTile = world.getTileEntity(containedPos); @@ -99,7 +101,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi node.addConnection(containedPos); ChatUtil.sendChat(player, "Linked node to master!"); this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } } else { @@ -107,7 +109,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi node.addConnection(containedPos); ChatUtil.sendChat(player, "Linked node to master!"); this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } } else if (node instanceof IMasterRoutingNode) @@ -124,7 +126,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi master.addNodeToList(pastNode); ChatUtil.sendChat(player, "Linked node to master!"); this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } } else { @@ -132,7 +134,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi pastNode.addConnection(pos); ChatUtil.sendChat(player, "Linked node to master!"); this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } } else { @@ -152,7 +154,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi node.addConnection(containedPos); ChatUtil.sendChat(player, "Linked nodes together."); 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 { TileEntity tile = world.getTileEntity(node.getMasterPos()); @@ -167,7 +169,7 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi node.addConnection(containedPos); ChatUtil.sendChat(player, "Linked nodes together."); 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 { TileEntity tile = world.getTileEntity(pastNode.getMasterPos()); @@ -182,17 +184,17 @@ public class ItemNodeRouter extends Item implements INodeRenderer, IVariantProvi node.addConnection(containedPos); ChatUtil.sendChat(player, "Linked nodes together."); this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } else { this.setBlockPos(stack, BlockPos.ORIGIN); - return true; + return EnumActionResult.SUCCESS; } } } } - return false; + return EnumActionResult.FAIL; } @Override