Search in sources :

Example 1 with DefaultIndexedLens

use of org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens in project SpongeCommon by SpongePowered.

the class HorseInventoryLens method init.

protected void init(SlotLensProvider slots) {
    // 0-1
    this.horseEquipment = new DefaultIndexedLens(0, 2, slots);
    this.addSpanningChild(this.horseEquipment);
    this.addMissingSpanningSlots(2, slots);
// TODO only for "chested" horses. Will this cause problems?
// this.chest = new GridInventoryLensImpl(2, 5, 3, 5, slots);             // 2-16
// this.addSpanningChild(this.chest);
}
Also used : DefaultIndexedLens(org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens)

Example 2 with DefaultIndexedLens

use of org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens in project SpongeCommon by SpongePowered.

the class BrewingStandInventoryLens method init.

protected void init(final SlotLensProvider slots) {
    // TODO filter
    this.potions = new DefaultIndexedLens(0, 3, slots);
    this.ingredient = new InputSlotLens(slots.getSlotLens(3), ItemStackFilter.filterIInventory(3));
    this.fuel = new FuelSlotLens(slots.getSlotLens(4), ItemStackFilter.filterIInventory(4));
    this.addSpanningChild(this.potions);
    this.addSpanningChild(this.ingredient);
    this.addSpanningChild(this.fuel);
}
Also used : InputSlotLens(org.spongepowered.common.inventory.lens.impl.slot.InputSlotLens) DefaultIndexedLens(org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens) FuelSlotLens(org.spongepowered.common.inventory.lens.impl.slot.FuelSlotLens)

Example 3 with DefaultIndexedLens

use of org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens in project SpongeCommon by SpongePowered.

the class FurnaceInventoryLens method init.

protected void init(final SlotLensProvider slots) {
    this.addSpanningChild(new DefaultIndexedLens(0, 3, slots));
    this.input = new InputSlotLens(slots.getSlotLens(0), ItemStackFilter.filterIInventory(0));
    this.fuel = new FuelSlotLens(slots.getSlotLens(1), ItemStackFilter.filterIInventory(1));
    this.output = new OutputSlotLens(slots.getSlotLens(2), ItemStackFilter.filterIInventory(2));
    this.addChild(this.input, KeyValuePair.slotIndex(0));
    this.addChild(this.fuel, KeyValuePair.slotIndex(1));
    this.addChild(this.output, KeyValuePair.slotIndex(2));
}
Also used : InputSlotLens(org.spongepowered.common.inventory.lens.impl.slot.InputSlotLens) DefaultIndexedLens(org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens) FuelSlotLens(org.spongepowered.common.inventory.lens.impl.slot.FuelSlotLens) OutputSlotLens(org.spongepowered.common.inventory.lens.impl.slot.OutputSlotLens)

Example 4 with DefaultIndexedLens

use of org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens in project SpongeCommon by SpongePowered.

the class SpongeInventoryBuilder method slots.

public BuildingStep slots(int amount) {
    this.size += amount;
    net.minecraft.world.SimpleContainer adapter = new net.minecraft.world.SimpleContainer(amount);
    this.inventories.add((Inventory) adapter);
    this.lenses.add(new DefaultIndexedLens(0, amount, ((InventoryAdapter) adapter).inventoryAdapter$getSlotLensProvider()));
    return this;
}
Also used : InventoryAdapter(org.spongepowered.common.inventory.adapter.InventoryAdapter) DefaultIndexedLens(org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens)

Aggregations

DefaultIndexedLens (org.spongepowered.common.inventory.lens.impl.DefaultIndexedLens)4 FuelSlotLens (org.spongepowered.common.inventory.lens.impl.slot.FuelSlotLens)2 InputSlotLens (org.spongepowered.common.inventory.lens.impl.slot.InputSlotLens)2 InventoryAdapter (org.spongepowered.common.inventory.adapter.InventoryAdapter)1 OutputSlotLens (org.spongepowered.common.inventory.lens.impl.slot.OutputSlotLens)1