Search in sources :

Example 1 with ExtractionCountMode

use of com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode in project Create by Creators-of-Create.

the class ChuteTileEntity method handleInput.

private void handleInput(IItemHandler inv, float startLocation) {
    if (inv == null)
        return;
    Predicate<ItemStack> canAccept = this::canAcceptItem;
    int count = getExtractionAmount();
    ExtractionCountMode mode = getExtractionMode();
    if (mode == ExtractionCountMode.UPTO || !ItemHelper.extract(inv, canAccept, mode, count, true).isEmpty()) {
        ItemStack extracted = ItemHelper.extract(inv, canAccept, mode, count, false);
        if (!extracted.isEmpty())
            setItem(extracted, startLocation);
    }
}
Also used : ExtractionCountMode(com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode) ItemStack(net.minecraft.world.item.ItemStack)

Aggregations

ExtractionCountMode (com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode)1 ItemStack (net.minecraft.world.item.ItemStack)1