Search in sources :

Example 1 with OrderedInventoryAdapter

use of org.spongepowered.common.item.inventory.adapter.impl.comp.OrderedInventoryAdapter in project SpongeCommon by SpongePowered.

the class MixinSlot method parent.

@Override
public Inventory parent() {
    if (this.inventory instanceof Inventory) {
        return ((Inventory) this.inventory);
    }
    if (this.parentAdapter == null) {
        OrderedInventoryLensImpl lens = new OrderedInventoryLensImpl(0, this.fabric.getSize(), 1, new SlotCollection.Builder().add(this.fabric.getSize()).build());
        this.parentAdapter = new OrderedInventoryAdapter(this.fabric, lens);
    }
    return this.parentAdapter;
}
Also used : SlotCollection(org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection) OrderedInventoryAdapter(org.spongepowered.common.item.inventory.adapter.impl.comp.OrderedInventoryAdapter) OrderedInventoryLensImpl(org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl) Inventory(org.spongepowered.api.item.inventory.Inventory) IInventory(net.minecraft.inventory.IInventory)

Aggregations

IInventory (net.minecraft.inventory.IInventory)1 Inventory (org.spongepowered.api.item.inventory.Inventory)1 OrderedInventoryAdapter (org.spongepowered.common.item.inventory.adapter.impl.comp.OrderedInventoryAdapter)1 SlotCollection (org.spongepowered.common.item.inventory.lens.impl.collections.SlotCollection)1 OrderedInventoryLensImpl (org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl)1