use of mekanism.common.inventory.slot.BasicInventorySlot in project Mekanism by mekanism.
the class TileEntityDigitalMiner method getInitialInventory.
@Nonnull
@Override
protected IInventorySlotHolder getInitialInventory() {
mainSlots = new ArrayList<>();
InventorySlotHelper builder = InventorySlotHelper.forSide(this::getDirection, side -> side == RelativeSide.TOP, side -> side == RelativeSide.BACK);
// Allow insertion manually or internally, or if it is a replace stack
BiPredicate<@NonNull ItemStack, @NonNull AutomationType> canInsert = (stack, automationType) -> automationType != AutomationType.EXTERNAL || isReplaceTarget(stack.getItem());
// Allow extraction if it is manual or if it is a replace stack
BiPredicate<@NonNull ItemStack, @NonNull AutomationType> canExtract = (stack, automationType) -> automationType == AutomationType.MANUAL || !isReplaceTarget(stack.getItem());
for (int slotY = 0; slotY < 3; slotY++) {
for (int slotX = 0; slotX < 9; slotX++) {
BasicInventorySlot slot = BasicInventorySlot.at(canExtract, canInsert, this, 8 + slotX * 18, 92 + slotY * 18);
builder.addSlot(slot, RelativeSide.BACK, RelativeSide.TOP);
mainSlots.add(slot);
}
}
builder.addSlot(energySlot = EnergyInventorySlot.fillOrConvert(energyContainer, this::getLevel, this, 152, 20));
return builder.build();
}
Aggregations