Search in sources :

Example 1 with ComputerException

use of mekanism.common.integration.computer.ComputerException 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 2 with ComputerException

use of mekanism.common.integration.computer.ComputerException 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)

Example 3 with ComputerException

use of mekanism.common.integration.computer.ComputerException in project Mekanism by mekanism.

the class TileEntityQuantumEntangloporter method setFrequency.

@ComputerMethod
private void setFrequency(String name) throws ComputerException {
    validateSecurityIsPublic();
    InventoryFrequency frequency = FrequencyType.INVENTORY.getManagerWrapper().getPublicManager().getFrequency(name);
    if (frequency == null) {
        throw new ComputerException("No public inventory frequency with name '%s' found.", name);
    }
    setFrequency(FrequencyType.INVENTORY, frequency.getIdentity(), getOwnerUUID());
}
Also used : 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)

Example 4 with ComputerException

use of mekanism.common.integration.computer.ComputerException in project Mekanism by mekanism.

the class TileEntityQIORedstoneAdapter method setTargetItem.

@ComputerMethod
private void setTargetItem(ResourceLocation itemName) throws ComputerException {
    validateSecurityIsPublic();
    Item item = ForgeRegistries.ITEMS.getValue(itemName);
    if (item == null || item == Items.AIR) {
        throw new ComputerException("Target item '%s' could not be found. If you are trying to clear it consider using clearTargetItem instead.", itemName);
    }
    handleStackChange(new ItemStack(item));
}
Also used : Item(net.minecraft.item.Item) HashedItem(mekanism.common.lib.inventory.HashedItem) ItemStack(net.minecraft.item.ItemStack) SyncableItemStack(mekanism.common.inventory.container.sync.SyncableItemStack) ComputerException(mekanism.common.integration.computer.ComputerException) ComputerMethod(mekanism.common.integration.computer.annotation.ComputerMethod)

Example 5 with ComputerException

use of mekanism.common.integration.computer.ComputerException in project Mekanism by mekanism.

the class TileEntityQIOComponent method setFrequency.

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

Aggregations

ComputerException (mekanism.common.integration.computer.ComputerException)10 ComputerMethod (mekanism.common.integration.computer.annotation.ComputerMethod)10 WrappingComputerMethod (mekanism.common.integration.computer.annotation.WrappingComputerMethod)5 FrequencyIdentity (mekanism.common.lib.frequency.Frequency.FrequencyIdentity)3 InventoryFrequency (mekanism.common.content.entangloporter.InventoryFrequency)2 QIOFrequency (mekanism.common.content.qio.QIOFrequency)2 TeleporterFrequency (mekanism.common.content.teleporter.TeleporterFrequency)2 SyncableItemStack (mekanism.common.inventory.container.sync.SyncableItemStack)2 ConfigInfo (mekanism.common.tile.component.config.ConfigInfo)2 ItemStack (net.minecraft.item.ItemStack)2 SyntheticComputerMethod (mekanism.common.integration.computer.annotation.SyntheticComputerMethod)1 ItemCraftingFormula (mekanism.common.item.ItemCraftingFormula)1 HashedItem (mekanism.common.lib.inventory.HashedItem)1 DataType (mekanism.common.tile.component.config.DataType)1 Item (net.minecraft.item.Item)1