Search in sources :

Example 16 with ComputerMethod

use of mekanism.common.integration.computer.annotation.ComputerMethod in project Mekanism by mekanism.

the class TileEntityQIOComponent method createFrequency.

@ComputerMethod
private void createFrequency(String name) throws ComputerException {
    validateSecurityIsPublic();
    QIOFrequency frequency = FrequencyType.QIO.getManagerWrapper().getPublicManager().getFrequency(name);
    if (frequency != null) {
        throw new ComputerException("Unable to create public QIO frequency with name '%s' as one already exists.", name);
    }
    setFrequency(FrequencyType.QIO, new FrequencyIdentity(name, true), getOwnerUUID());
}
Also used : FrequencyIdentity(mekanism.common.lib.frequency.Frequency.FrequencyIdentity) QIOFrequency(mekanism.common.content.qio.QIOFrequency) ComputerException(mekanism.common.integration.computer.ComputerException) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 17 with ComputerMethod

use of mekanism.common.integration.computer.annotation.ComputerMethod in project Mekanism by mekanism.

the class TurbineMultiblockData method getMaxProduction.

@ComputerMethod
public FloatingLong getMaxProduction() {
    FloatingLong energyMultiplier = MekanismConfig.general.maxEnergyPerSteam.get().divide(TurbineValidator.MAX_BLADES).multiply(Math.min(blades, coils * MekanismGeneratorsConfig.generators.turbineBladesPerCoil.get()));
    double rate = lowerVolume * (getDispersers() * MekanismGeneratorsConfig.generators.turbineDisperserGasFlow.get());
    rate = Math.min(rate, vents * MekanismGeneratorsConfig.generators.turbineVentGasFlow.get());
    return energyMultiplier.multiply(rate);
}
Also used : FloatingLong(mekanism.api.math.FloatingLong) WrappingComputerMethod(mekanism.common.integration.computer.annotation.WrappingComputerMethod) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod) SyntheticComputerMethod(mekanism.common.integration.computer.annotation.SyntheticComputerMethod)

Example 18 with ComputerMethod

use of mekanism.common.integration.computer.annotation.ComputerMethod in project Mekanism by mekanism.

the class TileEntityTeleporter method decrementFrequencyColor.

@ComputerMethod
private void decrementFrequencyColor() throws ComputerException {
    validateSecurityIsPublic();
    TeleporterFrequency frequency = getFrequency();
    frequency.setColor(frequency.getColor().getPrevious());
}
Also used : TeleporterFrequency(mekanism.common.content.teleporter.TeleporterFrequency) WrappingComputerMethod(mekanism.common.integration.computer.annotation.WrappingComputerMethod) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 19 with ComputerMethod

use of mekanism.common.integration.computer.annotation.ComputerMethod in project Mekanism by mekanism.

the class TileComponentConfig method setMode.

@ComputerMethod
private void setMode(TransmissionType type, RelativeSide side, DataType mode) throws ComputerException {
    tile.validateSecurityIsPublic();
    validateSupportedTransmissionType(type);
    ConfigInfo config = configInfo.get(type);
    if (!config.getSupportedDataTypes().contains(mode)) {
        throw new ComputerException("This machine does not support mode '%s' for transmission type '%s'.", mode, type);
    }
    DataType currentMode = config.getDataType(side);
    if (mode != currentMode) {
        config.setDataType(mode, side);
        sideChanged(type, side);
    }
}
Also used : DataType(mekanism.common.tile.component.config.DataType) ConfigInfo(mekanism.common.tile.component.config.ConfigInfo) ComputerException(mekanism.common.integration.computer.ComputerException) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 20 with ComputerMethod

use of mekanism.common.integration.computer.annotation.ComputerMethod in project Mekanism by mekanism.

the class TileEntityTeleporter method createFrequency.

@ComputerMethod
private void createFrequency(String name) throws ComputerException {
    validateSecurityIsPublic();
    TeleporterFrequency frequency = FrequencyType.TELEPORTER.getManagerWrapper().getPublicManager().getFrequency(name);
    if (frequency != null) {
        throw new ComputerException("Unable to create public teleporter frequency with name '%s' as one already exists.", name);
    }
    setFrequency(FrequencyType.TELEPORTER, new FrequencyIdentity(name, true), getOwnerUUID());
}
Also used : TeleporterFrequency(mekanism.common.content.teleporter.TeleporterFrequency) FrequencyIdentity(mekanism.common.lib.frequency.Frequency.FrequencyIdentity) ComputerException(mekanism.common.integration.computer.ComputerException) WrappingComputerMethod(mekanism.common.integration.computer.annotation.WrappingComputerMethod) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Aggregations

ComputerMethod (mekanism.common.integration.computer.annotation.ComputerMethod)23 ComputerException (mekanism.common.integration.computer.ComputerException)10 WrappingComputerMethod (mekanism.common.integration.computer.annotation.WrappingComputerMethod)9 QIOFrequency (mekanism.common.content.qio.QIOFrequency)4 TeleporterFrequency (mekanism.common.content.teleporter.TeleporterFrequency)4 ConfigInfo (mekanism.common.tile.component.config.ConfigInfo)4 SyntheticComputerMethod (mekanism.common.integration.computer.annotation.SyntheticComputerMethod)3 FrequencyIdentity (mekanism.common.lib.frequency.Frequency.FrequencyIdentity)3 Nonnull (javax.annotation.Nonnull)2 FloatingLong (mekanism.api.math.FloatingLong)2 InventoryFrequency (mekanism.common.content.entangloporter.InventoryFrequency)2 DiversionTransporter (mekanism.common.content.network.transmitter.DiversionTransporter)2 BoundComputerMethod (mekanism.common.integration.computer.BoundComputerMethod)2 SyncableItemStack (mekanism.common.inventory.container.sync.SyncableItemStack)2 ItemStack (net.minecraft.item.ItemStack)2 Object2ObjectOpenHashMap (it.unimi.dsi.fastutil.objects.Object2ObjectOpenHashMap)1 ElementType (java.lang.annotation.ElementType)1 MethodHandle (java.lang.invoke.MethodHandle)1 MethodHandles (java.lang.invoke.MethodHandles)1 Field (java.lang.reflect.Field)1