Search in sources :

Example 1 with ComputerMethod

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

the class TileEntitySawingFactory method getSecondaryOutput.

// Methods relating to IComputerTile
@ComputerMethod
private ItemStack getSecondaryOutput(int process) throws ComputerException {
    validateValidProcess(process);
    IInventorySlot secondaryOutputSlot = processInfoSlots[process].getSecondaryOutputSlot();
    // This should never be null, but in case it is, handle it
    return secondaryOutputSlot == null ? ItemStack.EMPTY : secondaryOutputSlot.getStack();
}
Also used : IInventorySlot(mekanism.api.inventory.IInventorySlot) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 2 with ComputerMethod

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

the class TileEntityTeleporter method incrementFrequencyColor.

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

Example 3 with ComputerMethod

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

the class TileEntityTeleporter method setFrequency.

@ComputerMethod
private void setFrequency(String name) throws ComputerException {
    validateSecurityIsPublic();
    TeleporterFrequency frequency = FrequencyType.TELEPORTER.getManagerWrapper().getPublicManager().getFrequency(name);
    if (frequency == null) {
        throw new ComputerException("No public teleporter frequency with name '%s' found.", name);
    }
    setFrequency(FrequencyType.TELEPORTER, frequency.getIdentity(), getOwnerUUID());
}
Also used : TeleporterFrequency(mekanism.common.content.teleporter.TeleporterFrequency) ComputerException(mekanism.common.integration.computer.ComputerException) WrappingComputerMethod(mekanism.common.integration.computer.annotation.WrappingComputerMethod) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 4 with ComputerMethod

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

the class TileEntityMekanism method getTotalEnergyFilledPercentage.

@ComputerMethod(nameOverride = "getEnergyFilledPercentage", restriction = MethodRestriction.ENERGY)
private double getTotalEnergyFilledPercentage() {
    FloatingLong stored = FloatingLong.ZERO;
    FloatingLong max = FloatingLong.ZERO;
    List<IEnergyContainer> energyContainers = getEnergyContainers(null);
    for (IEnergyContainer energyContainer : energyContainers) {
        stored = stored.plusEqual(energyContainer.getEnergy());
        max = max.plusEqual(energyContainer.getMaxEnergy());
    }
    return stored.divideToLevel(max);
}
Also used : SyncableFloatingLong(mekanism.common.inventory.container.sync.SyncableFloatingLong) FloatingLong(mekanism.api.math.FloatingLong) IEnergyContainer(mekanism.api.energy.IEnergyContainer) BoundComputerMethod(mekanism.common.integration.computer.BoundComputerMethod) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 5 with ComputerMethod

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

the class TileEntityQuantumEntangloporter method createFrequency.

@ComputerMethod
private void createFrequency(String name) throws ComputerException {
    validateSecurityIsPublic();
    InventoryFrequency frequency = FrequencyType.INVENTORY.getManagerWrapper().getPublicManager().getFrequency(name);
    if (frequency != null) {
        throw new ComputerException("Unable to create public inventory frequency with name '%s' as one already exists.", name);
    }
    setFrequency(FrequencyType.INVENTORY, new FrequencyIdentity(name, true), getOwnerUUID());
}
Also used : FrequencyIdentity(mekanism.common.lib.frequency.Frequency.FrequencyIdentity) InventoryFrequency(mekanism.common.content.entangloporter.InventoryFrequency) 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