use of mekanism.common.tile.component.config.ConfigInfo in project Mekanism by mekanism.
the class TileComponentConfig method setupInputConfig.
public ConfigInfo setupInputConfig(TransmissionType type, Object container) {
ConfigInfo config = getConfig(type);
if (config != null) {
config.addSlotInfo(DataType.INPUT, createInfo(type, true, false, container));
config.fill(DataType.INPUT);
config.setCanEject(false);
}
return config;
}
use of mekanism.common.tile.component.config.ConfigInfo in project Mekanism by mekanism.
the class TileComponentConfig method setupItemIOExtraConfig.
public ConfigInfo setupItemIOExtraConfig(IInventorySlot inputSlot, IInventorySlot outputSlot, IInventorySlot extraSlot, IInventorySlot energySlot) {
ConfigInfo itemConfig = getConfig(TransmissionType.ITEM);
if (itemConfig != null) {
itemConfig.addSlotInfo(DataType.INPUT, new InventorySlotInfo(true, false, inputSlot));
itemConfig.addSlotInfo(DataType.OUTPUT, new InventorySlotInfo(false, true, outputSlot));
itemConfig.addSlotInfo(DataType.INPUT_OUTPUT, new InventorySlotInfo(true, true, inputSlot, outputSlot));
itemConfig.addSlotInfo(DataType.EXTRA, new InventorySlotInfo(true, true, extraSlot));
itemConfig.addSlotInfo(DataType.ENERGY, new InventorySlotInfo(true, true, energySlot));
// Set default config directions
itemConfig.setDefaults();
}
return itemConfig;
}
use of mekanism.common.tile.component.config.ConfigInfo in project Mekanism by mekanism.
the class TileComponentConfig method setEjecting.
@ComputerMethod
private void setEjecting(TransmissionType type, boolean ejecting) throws ComputerException {
tile.validateSecurityIsPublic();
validateSupportedTransmissionType(type);
ConfigInfo config = configInfo.get(type);
if (!config.canEject()) {
throw new ComputerException("This machine does not support auto-ejecting for transmission type '%s'.", type);
}
if (config.isEjecting() != ejecting) {
config.setEjecting(ejecting);
tile.markDirty(false);
}
}
use of mekanism.common.tile.component.config.ConfigInfo in project Mekanism by mekanism.
the class TileComponentConfig method getSpecificSyncableData.
@Override
public List<ISyncableData> getSpecificSyncableData() {
List<ISyncableData> list = new ArrayList<>();
List<TransmissionType> transmissions = getTransmissions();
for (TransmissionType transmission : transmissions) {
ConfigInfo info = configInfo.get(transmission);
list.add(SyncableBoolean.create(info::isEjecting, info::setEjecting));
}
return list;
}
use of mekanism.common.tile.component.config.ConfigInfo in project Mekanism by mekanism.
the class GuiMekanismTile method getFromSlot.
private DataType getFromSlot(Slot slot) {
if (slot.index < tile.getSlots() && slot instanceof InventoryContainerSlot) {
ISideConfiguration config = (ISideConfiguration) tile;
ConfigInfo info = config.getConfig().getConfig(TransmissionType.ITEM);
if (info != null) {
Set<DataType> supportedDataTypes = info.getSupportedDataTypes();
IInventorySlot inventorySlot = ((InventoryContainerSlot) slot).getInventorySlot();
for (DataType type : supportedDataTypes) {
ISlotInfo slotInfo = info.getSlotInfo(type);
if (slotInfo instanceof InventorySlotInfo && ((InventorySlotInfo) slotInfo).hasSlot(inventorySlot)) {
return type;
}
}
}
}
return null;
}
Aggregations