Add in "armor ticking"- implement the interface and the armor piece will tick.
Update FML:22dbe41 22dbe41 Fix up mistake that broke all modloading. Nice.
This commit is contained in:
parent
3a0634b5d1
commit
fbf9527be3
3 changed files with 40 additions and 0 deletions
15
common/net/minecraftforge/common/ITickingArmor.java
Normal file
15
common/net/minecraftforge/common/ITickingArmor.java
Normal file
|
@ -0,0 +1,15 @@
|
|||
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);
|
||||
}
|
Binary file not shown.
|
@ -0,0 +1,25 @@
|
|||
--- ../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 @@
|
||||
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)
|
||||
+ {
|
||||
+ ((ITickingArmor)this.armorInventory[i].getItem()).onArmorTickUpdate(this.player.worldObj, this.player, this.armorInventory[i]);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
Loading…
Reference in a new issue