Remove the single use interface ITickingArmor, and apply to Item directly.

This commit is contained in:
Christian 2013-02-04 17:53:47 -05:00
parent 40a3660c93
commit afea4fce1d
3 changed files with 18 additions and 27 deletions

View file

@ -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);
}

View file

@ -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]);
+ }
+ }
}

View file

@ -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)
+ {
+
+ }
+
}