use of org.spongepowered.common.inventory.lens.impl.minecraft.PlayerInventoryLens in project SpongeCommon by SpongePowered.
the class InventoryMixin_Inventory_API method primary.
@Override
public PrimaryPlayerInventory primary() {
if (this.api$primary == null && ((InventoryAdapter) this).inventoryAdapter$getRootLens() instanceof PlayerInventoryLens) {
final Lens lens = ((InventoryAdapter) this).inventoryAdapter$getRootLens();
final Fabric fabric = ((InventoryAdapter) this).inventoryAdapter$getFabric();
this.api$primary = (PrimaryPlayerInventoryAdapter) ((PlayerInventoryLens) lens).getPrimaryInventoryLens().getAdapter(fabric, this);
}
return this.api$primary;
}
use of org.spongepowered.common.inventory.lens.impl.minecraft.PlayerInventoryLens in project SpongeCommon by SpongePowered.
the class ContainerPlayerInventoryLens method lenses.
private static List<Lens> lenses(int size, SlotLensProvider slots) {
// 1
int base = ContainerPlayerInventoryLens.CRAFTING_OUTPUT;
final CraftingInventoryLens crafting = new CraftingInventoryLens(0, base, ContainerPlayerInventoryLens.CRAFTING_GRID, ContainerPlayerInventoryLens.CRAFTING_GRID, slots);
// 4
base += ContainerPlayerInventoryLens.CRAFTING_GRID * ContainerPlayerInventoryLens.CRAFTING_GRID;
final PlayerInventoryLens player = new PlayerInventoryLens(base, size - base, slots);
return Arrays.asList(crafting, player);
}
Aggregations