Search in sources :

Example 6 with ItemStackList

use of net.silentchaos512.lib.collection.ItemStackList in project SilentGems by SilentChaos512.

the class BaublesCompat method getBaubles.

public static ItemStackList getBaubles(EntityPlayer player, Predicate<ItemStack> predicate) {
    ItemStackList list = ItemStackList.create();
    if (!MOD_LOADED)
        return list;
    IBaublesItemHandler inv = BaublesApi.getBaublesHandler(player);
    for (int i = 0; i < inv.getSlots(); ++i) {
        ItemStack stack = inv.getStackInSlot(i);
        if (StackHelper.isValid(stack) && predicate.apply(stack)) {
            list.add(stack);
        }
    }
    return list;
}
Also used : ItemStackList(net.silentchaos512.lib.collection.ItemStackList) IBaublesItemHandler(baubles.api.cap.IBaublesItemHandler) ItemStack(net.minecraft.item.ItemStack)

Aggregations

ItemStack (net.minecraft.item.ItemStack)6 ItemStackList (net.silentchaos512.lib.collection.ItemStackList)6 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 PlayerHelper (net.silentchaos512.lib.util.PlayerHelper)3 Predicate (com.google.common.base.Predicate)2 IMessage (net.minecraftforge.fml.common.network.simpleimpl.IMessage)2 MessageContext (net.minecraftforge.fml.common.network.simpleimpl.MessageContext)2 Side (net.minecraftforge.fml.relauncher.Side)2 BaublesCompat (net.silentchaos512.gems.compat.BaublesCompat)2 Message (net.silentchaos512.gems.network.Message)2 IBaublesItemHandler (baubles.api.cap.IBaublesItemHandler)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 Random (java.util.Random)1 EntityLivingBase (net.minecraft.entity.EntityLivingBase)1 MobEffects (net.minecraft.init.MobEffects)1 SoundEvents (net.minecraft.init.SoundEvents)1 PotionEffect (net.minecraft.potion.PotionEffect)1 DamageSource (net.minecraft.util.DamageSource)1 SoundCategory (net.minecraft.util.SoundCategory)1