Search in sources :

Example 1 with BasicSlotLens

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

the class SlotMixin_Lens_Inventory method lensGeneratorBridge$generateLens.

@Override
public Lens lensGeneratorBridge$generateLens(SlotLensProvider slotLensProvider) {
    try {
        final Lens rootLens = ((InventoryAdapter) this.container).inventoryAdapter$getRootLens();
        SlotLens lens = rootLens.getSlotLens(this.inventoryAdapter$getFabric(), this.slot);
        if (lens != null) {
            return lens;
        }
    } catch (Exception ignored) {
    }
    // this works as a fallback but removes Inventory Property Support completely
    return new BasicSlotLens(0);
}
Also used : InventoryAdapter(org.spongepowered.common.inventory.adapter.InventoryAdapter) BasicSlotLens(org.spongepowered.common.inventory.lens.impl.slot.BasicSlotLens) Lens(org.spongepowered.common.inventory.lens.Lens) SlotLens(org.spongepowered.common.inventory.lens.slots.SlotLens) BasicSlotLens(org.spongepowered.common.inventory.lens.impl.slot.BasicSlotLens) SlotLens(org.spongepowered.common.inventory.lens.slots.SlotLens) BasicSlotLens(org.spongepowered.common.inventory.lens.impl.slot.BasicSlotLens)

Aggregations

InventoryAdapter (org.spongepowered.common.inventory.adapter.InventoryAdapter)1 Lens (org.spongepowered.common.inventory.lens.Lens)1 BasicSlotLens (org.spongepowered.common.inventory.lens.impl.slot.BasicSlotLens)1 SlotLens (org.spongepowered.common.inventory.lens.slots.SlotLens)1