use of org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl 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;
}
use of org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl in project SpongeCommon by SpongePowered.
the class DelegatingLens method init.
@Override
protected void init(SlotProvider<IInventory, ItemStack> slots) {
this.addSpanningChild(new OrderedInventoryLensImpl(this.base, this.size, 1, slots));
this.addChild(delegate);
}
use of org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl in project SpongeCommon by SpongePowered.
the class FurnaceInventoryLens method init.
@Override
protected void init(SlotProvider<IInventory, ItemStack> slots) {
this.addChild(new OrderedInventoryLensImpl(0, 3, 1, slots));
this.input = new InputSlotLensImpl(0, (i) -> true, (i) -> true);
// TODO SlotFurnaceFuel
this.fuel = new FuelSlotLensImpl(1, (i) -> true, (i) -> true);
// SlotFurnaceOutput
this.output = new OutputSlotLensImpl(2, (i) -> false, (i) -> false);
this.addSpanningChild(this.input, new SlotIndex(0));
this.addSpanningChild(this.fuel, new SlotIndex(1));
this.addSpanningChild(this.output, new SlotIndex(2));
}
use of org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl in project SpongeCommon by SpongePowered.
the class CustomLens method addLensFor.
private int addLensFor(InventoryProperty<?, ?> size, int base, SlotProvider<IInventory, ItemStack> slots) {
Lens<IInventory, ItemStack> lens;
int slotCount;
if (size instanceof InventoryDimension) {
InventoryDimension dimension = ((InventoryDimension) size);
slotCount = dimension.getColumns() * dimension.getRows();
lens = new GridInventoryLensImpl(base, dimension.getColumns(), dimension.getRows(), dimension.getColumns(), slots);
} else if (size instanceof InventoryCapacity) {
InventoryCapacity capacity = ((InventoryCapacity) size);
slotCount = capacity.getValue();
lens = new OrderedInventoryLensImpl(base, capacity.getValue(), 1, slots);
} else {
throw new IllegalStateException("Unknown Inventory Size Property " + size.getClass().getName());
}
this.addSpanningChild(lens);
return slotCount;
}
use of org.spongepowered.common.item.inventory.lens.impl.comp.OrderedInventoryLensImpl in project SpongeCommon by SpongePowered.
the class MixinEntityMinecartHopper method onConstructed.
@Inject(method = "<init>*", at = @At("RETURN"))
public void onConstructed(CallbackInfo ci) {
this.fabric = new IInventoryFabric(this);
this.slots = new SlotCollection.Builder().add(5).build();
this.lens = new OrderedInventoryLensImpl(0, 5, 1, this.slots);
}
Aggregations