use of org.spongepowered.common.inventory.fabric.CompoundFabric in project SpongeCommon by SpongePowered.
the class UnionQuery method execute.
@Override
public Inventory execute(Inventory inventory, InventoryAdapter adapter) {
final CompoundLens.Builder lensBuilder = CompoundLens.builder().add(adapter.inventoryAdapter$getRootLens());
final CompoundFabric fabric = new CompoundFabric(adapter.inventoryAdapter$getFabric(), ((InventoryBridge) this.other).bridge$getAdapter().inventoryAdapter$getFabric());
final CompoundSlotLensProvider provider = new CompoundSlotLensProvider().add(adapter);
for (final Inventory inv : this.other.children()) {
lensBuilder.add(((InventoryAdapter) inv).inventoryAdapter$getRootLens());
provider.add((InventoryAdapter) inv);
}
final CompoundLens lens = lensBuilder.build(provider);
return lens.getAdapter(fabric, inventory);
}
Aggregations