From afea4fce1d641ac076f1e2c311572734f376ad3a Mon Sep 17 00:00:00 2001 From: Christian Date: Mon, 4 Feb 2013 17:53:47 -0500 Subject: [PATCH] Remove the single use interface ITickingArmor, and apply to Item directly. --- .../net/minecraftforge/common/ITickingArmor.java | 15 --------------- .../entity/player/InventoryPlayer.java.patch | 14 +++----------- .../minecraft/net/minecraft/item/Item.java.patch | 16 +++++++++++++++- 3 files changed, 18 insertions(+), 27 deletions(-) delete mode 100644 common/net/minecraftforge/common/ITickingArmor.java diff --git a/common/net/minecraftforge/common/ITickingArmor.java b/common/net/minecraftforge/common/ITickingArmor.java deleted file mode 100644 index 3c240d3d8..000000000 --- a/common/net/minecraftforge/common/ITickingArmor.java +++ /dev/null @@ -1,15 +0,0 @@ -package net.minecraftforge.common; - -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; - -/** - * A simple interface to receive ticks from armor items when placed in armor slots. - * - * @author cpw - * - */ -public interface ITickingArmor { - void onArmorTickUpdate(World worldObj, EntityPlayer player, ItemStack itemStack); -} diff --git a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch index 74f15678f..9f0a109f0 100644 --- a/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch +++ b/patches/minecraft/net/minecraft/entity/player/InventoryPlayer.java.patch @@ -1,23 +1,15 @@ --- ../src_base/minecraft/net/minecraft/entity/player/InventoryPlayer.java +++ ../src_work/minecraft/net/minecraft/entity/player/InventoryPlayer.java -@@ -10,6 +10,7 @@ - import net.minecraft.item.ItemStack; - import net.minecraft.nbt.NBTTagCompound; - import net.minecraft.nbt.NBTTagList; -+import net.minecraftforge.common.ITickingArmor; - - public class InventoryPlayer implements IInventory - { -@@ -337,6 +338,14 @@ +@@ -337,6 +337,14 @@ this.mainInventory[var1].updateAnimation(this.player.worldObj, this.player, var1, this.currentItem == var1); } } + + for (int i = 0; i < this.armorInventory.length; i++) + { -+ if (this.armorInventory[i] != null && this.armorInventory[i].getItem() instanceof ITickingArmor) ++ if (this.armorInventory[i] != null) + { -+ ((ITickingArmor)this.armorInventory[i].getItem()).onArmorTickUpdate(this.player.worldObj, this.player, this.armorInventory[i]); ++ this.armorInventory[i].getItem().onArmorTickUpdate(this.player.worldObj, this.player, this.armorInventory[i]); + } + } } diff --git a/patches/minecraft/net/minecraft/item/Item.java.patch b/patches/minecraft/net/minecraft/item/Item.java.patch index 4061dc3b8..7b248a427 100644 --- a/patches/minecraft/net/minecraft/item/Item.java.patch +++ b/patches/minecraft/net/minecraft/item/Item.java.patch @@ -57,7 +57,7 @@ Vec3 var23 = var13.addVector((double)var18 * var21, (double)var17 * var21, (double)var20 * var21); return par1World.rayTraceBlocks_do_do(var13, var23, par3, !par3); } -@@ -701,4 +716,304 @@ +@@ -701,4 +716,318 @@ { StatList.initStats(); } @@ -361,4 +361,18 @@ + { + return false; + } ++ ++ ++ /** ++ * Called to tick armor in the armor slot. Override to do something ++ * ++ * @param world ++ * @param player ++ * @param itemStack ++ */ ++ public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) ++ { ++ ++ } ++ }