mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-13 00:37:52 +00:00
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:
1 parent
3a0634b5d1
commit
fbf9527be3
3 files changed
+40
No files matched your search
@@ -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]);
|
||||
+ }
|
||||
+ }
|
||||
}
|
||||
|
||||
/**
|
||||
Reference in new issue
Block a user