Search in sources :

Example 1 with InputSlotLensImpl

use of org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl in project SpongeCommon by SpongePowered.

the class FurnaceInventoryLens method init.

@Override
protected void init(SlotProvider<IInventory, ItemStack> slots) {
    this.addChild(new OrderedInventoryLensImpl(0, 3, 1, slots));
    this.input = new InputSlotLensImpl(0, (i) -> true, (i) -> true);
    // TODO SlotFurnaceFuel
    this.fuel = new FuelSlotLensImpl(1, (i) -> true, (i) -> true);
    // SlotFurnaceOutput
    this.output = new OutputSlotLensImpl(2, (i) -> false, (i) -> false);
    this.addSpanningChild(this.input, new SlotIndex(0));
    this.addSpanningChild(this.fuel, new SlotIndex(1));
    this.addSpanningChild(this.output, new SlotIndex(2));
}
Also used : ItemStack(net.minecraft.item.ItemStack) InventoryAdapter(org.spongepowered.common.item.inventory.adapter.InventoryAdapter) SlotProvider(org.spongepowered.common.item.inventory.lens.SlotProvider) InputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl) IInventory(net.minecraft.inventory.IInventory) FuelSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.FuelSlotLensImpl) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) SlotIndex(org.spongepowered.api.item.inventory.property.SlotIndex) RealLens(org.spongepowered.common.item.inventory.lens.impl.RealLens) OutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.OutputSlotLensImpl) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) InputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl) SlotIndex(org.spongepowered.api.item.inventory.property.SlotIndex) FuelSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.FuelSlotLensImpl) OutputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.OutputSlotLensImpl)

Example 2 with InputSlotLensImpl

use of org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl in project SpongeCommon by SpongePowered.

the class BrewingStandInventoryLens method init.

@Override
protected void init(SlotProvider<IInventory, ItemStack> slots) {
    this.potions = new OrderedInventoryLensImpl(0, 3, 1, OutputSlot.class, slots);
    // TODO filter PotionIngredients
    this.ingredient = new InputSlotLensImpl(3, (i) -> true, (i) -> true);
    this.fuel = new FuelSlotLensImpl(4, (i) -> BLAZE_POWDER.equals(i.getType()), BLAZE_POWDER::equals);
    this.addSpanningChild(this.potions);
    this.addSpanningChild(this.ingredient);
    this.addSpanningChild(this.fuel);
}
Also used : ItemStack(net.minecraft.item.ItemStack) InventoryAdapter(org.spongepowered.common.item.inventory.adapter.InventoryAdapter) SlotProvider(org.spongepowered.common.item.inventory.lens.SlotProvider) BLAZE_POWDER(org.spongepowered.api.item.ItemTypes.BLAZE_POWDER) InputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl) IInventory(net.minecraft.inventory.IInventory) FuelSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.FuelSlotLensImpl) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) RealLens(org.spongepowered.common.item.inventory.lens.impl.RealLens) OutputSlot(org.spongepowered.api.item.inventory.slot.OutputSlot) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) InputSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl) FuelSlotLensImpl(org.spongepowered.common.item.inventory.lens.impl.slots.FuelSlotLensImpl) OutputSlot(org.spongepowered.api.item.inventory.slot.OutputSlot)

Aggregations

IInventory (net.minecraft.inventory.IInventory)2 ItemStack (net.minecraft.item.ItemStack)2 InventoryAdapter (org.spongepowered.common.item.inventory.adapter.InventoryAdapter)2 SlotProvider (org.spongepowered.common.item.inventory.lens.SlotProvider)2 RealLens (org.spongepowered.common.item.inventory.lens.impl.RealLens)2 OrderedInventoryLensImpl (org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl)2 FuelSlotLensImpl (org.spongepowered.common.item.inventory.lens.impl.slots.FuelSlotLensImpl)2 InputSlotLensImpl (org.spongepowered.common.item.inventory.lens.impl.slots.InputSlotLensImpl)2 BLAZE_POWDER (org.spongepowered.api.item.ItemTypes.BLAZE_POWDER)1 SlotIndex (org.spongepowered.api.item.inventory.property.SlotIndex)1 OutputSlot (org.spongepowered.api.item.inventory.slot.OutputSlot)1 OutputSlotLensImpl (org.spongepowered.common.item.inventory.lens.impl.slots.OutputSlotLensImpl)1