Search in sources :

Example 6 with IBaublesItemHandler

use of baubles.api.cap.IBaublesItemHandler 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)

Example 7 with IBaublesItemHandler

use of baubles.api.cap.IBaublesItemHandler in project ConvenientAdditions by Necr0.

the class BaublesApi method getBaubles.

/**
	 * Retrieves the baubles capability handler wrapped as a IInventory for the supplied player
	 */
@Deprecated
public static IInventory getBaubles(EntityPlayer player) {
    IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
    handler.setPlayer(player);
    return new BaublesInventoryWrapper(handler, player);
}
Also used : BaublesInventoryWrapper(baubles.api.inv.BaublesInventoryWrapper) IBaublesItemHandler(baubles.api.cap.IBaublesItemHandler)

Example 8 with IBaublesItemHandler

use of baubles.api.cap.IBaublesItemHandler in project ConvenientAdditions by Necr0.

the class BaublesApi method getBaublesHandler.

/**
	 * Retrieves the baubles inventory capability handler for the supplied player
	 */
public static IBaublesItemHandler getBaublesHandler(EntityPlayer player) {
    IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
    handler.setPlayer(player);
    return handler;
}
Also used : IBaublesItemHandler(baubles.api.cap.IBaublesItemHandler)

Example 9 with IBaublesItemHandler

use of baubles.api.cap.IBaublesItemHandler in project Random-Things by lumien231.

the class BaublesApi method getBaubles.

/**
 * Retrieves the baubles capability handler wrapped as a IInventory for the supplied player
 */
@Deprecated
public static IInventory getBaubles(EntityPlayer player) {
    IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
    handler.setPlayer(player);
    return new BaublesInventoryWrapper(handler, player);
}
Also used : BaublesInventoryWrapper(baubles.api.inv.BaublesInventoryWrapper) IBaublesItemHandler(baubles.api.cap.IBaublesItemHandler)

Example 10 with IBaublesItemHandler

use of baubles.api.cap.IBaublesItemHandler in project Random-Things by lumien231.

the class BaublesApi method getBaublesHandler.

/**
 * Retrieves the baubles inventory capability handler for the supplied player
 */
public static IBaublesItemHandler getBaublesHandler(EntityPlayer player) {
    IBaublesItemHandler handler = player.getCapability(BaublesCapabilities.CAPABILITY_BAUBLES, null);
    handler.setPlayer(player);
    return handler;
}
Also used : IBaublesItemHandler(baubles.api.cap.IBaublesItemHandler)

Aggregations

IBaublesItemHandler (baubles.api.cap.IBaublesItemHandler)10 ItemStack (net.minecraft.item.ItemStack)4 BaublesInventoryWrapper (baubles.api.inv.BaublesInventoryWrapper)3 ArrayList (java.util.ArrayList)1 ItemStackList (net.silentchaos512.lib.collection.ItemStackList)1