Search in sources :

Example 21 with ConfigInfo

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;
}
Also used : ConfigInfo(mekanism.common.tile.component.config.ConfigInfo)

Example 22 with ConfigInfo

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;
}
Also used : ConfigInfo(mekanism.common.tile.component.config.ConfigInfo) InventorySlotInfo(mekanism.common.tile.component.config.slot.InventorySlotInfo)

Example 23 with ConfigInfo

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);
    }
}
Also used : ConfigInfo(mekanism.common.tile.component.config.ConfigInfo) ComputerException(mekanism.common.integration.computer.ComputerException) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 24 with ConfigInfo

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;
}
Also used : TransmissionType(mekanism.common.lib.transmitter.TransmissionType) ArrayList(java.util.ArrayList) ISyncableData(mekanism.common.inventory.container.sync.ISyncableData) ConfigInfo(mekanism.common.tile.component.config.ConfigInfo)

Example 25 with ConfigInfo

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;
}
Also used : IInventorySlot(mekanism.api.inventory.IInventorySlot) ISlotInfo(mekanism.common.tile.component.config.slot.ISlotInfo) DataType(mekanism.common.tile.component.config.DataType) InventoryContainerSlot(mekanism.common.inventory.container.slot.InventoryContainerSlot) ConfigInfo(mekanism.common.tile.component.config.ConfigInfo) InventorySlotInfo(mekanism.common.tile.component.config.slot.InventorySlotInfo) ISideConfiguration(mekanism.common.tile.interfaces.ISideConfiguration)

Aggregations

ConfigInfo (mekanism.common.tile.component.config.ConfigInfo)27 TransmissionType (mekanism.common.lib.transmitter.TransmissionType)10 DataType (mekanism.common.tile.component.config.DataType)9 RelativeSide (mekanism.api.RelativeSide)8 Direction (net.minecraft.util.Direction)6 ArrayList (java.util.ArrayList)5 ComputerMethod (mekanism.common.integration.computer.annotation.ComputerMethod)5 CompoundNBT (net.minecraft.nbt.CompoundNBT)5 IInventorySlot (mekanism.api.inventory.IInventorySlot)4 ISlotInfo (mekanism.common.tile.component.config.slot.ISlotInfo)4 InventorySlotInfo (mekanism.common.tile.component.config.slot.InventorySlotInfo)4 TileEntity (net.minecraft.tileentity.TileEntity)4 EnumMap (java.util.EnumMap)3 Map (java.util.Map)3 Nonnull (javax.annotation.Nonnull)3 Nullable (javax.annotation.Nullable)3 ComputerException (mekanism.common.integration.computer.ComputerException)3 TileEntityMekanism (mekanism.common.tile.base.TileEntityMekanism)3 ISideConfiguration (mekanism.common.tile.interfaces.ISideConfiguration)3 HashMap (java.util.HashMap)2