Search in sources :

Example 1 with IPlayerInventoryTick

use of convenientadditions.api.item.IPlayerInventoryTick in project ConvenientAdditions by Necr0.

the class PlayerInventoryTickHandler method onPlayerInventoryTick.

@SubscribeEvent
public void onPlayerInventoryTick(TickEvent.PlayerTickEvent e) {
    EntityPlayer player = e.player;
    Iterable<SlotNotation> iter = InventoryIterator.getIterable(player, EnumInventory.MAIN);
    for (SlotNotation slot : iter) {
        ItemStack stack = slot.getItem();
        if (stack != null && stack.getItem() instanceof IPlayerInventoryTick) {
            ((IPlayerInventoryTick) stack.getItem()).onPlayerInventoryTick(stack, slot, player);
            ;
        }
    }
}
Also used : EntityPlayer(net.minecraft.entity.player.EntityPlayer) IPlayerInventoryTick(convenientadditions.api.item.IPlayerInventoryTick) ItemStack(net.minecraft.item.ItemStack) SlotNotation(convenientadditions.api.inventory.SlotNotation) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Aggregations

SlotNotation (convenientadditions.api.inventory.SlotNotation)1 IPlayerInventoryTick (convenientadditions.api.item.IPlayerInventoryTick)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 ItemStack (net.minecraft.item.ItemStack)1 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)1