Search in sources :

Example 1 with TeleporterFrequency

use of mekanism.common.content.teleporter.TeleporterFrequency in project Mekanism by mekanism.

the class TileEntityTeleporter method onUpdateServer.

@Override
protected void onUpdateServer() {
    super.onUpdateServer();
    if (teleportBounds == null && frameDirection != null) {
        resetBounds();
    }
    status = canTeleport();
    if (MekanismUtils.canFunction(this) && status == 1 && teleDelay == 0) {
        teleport();
    }
    if (teleDelay == 0 && teleportBounds != null && !didTeleport.isEmpty()) {
        cleanTeleportCache();
    }
    boolean prevShouldRender = shouldRender;
    shouldRender = status == 1 || status > 4;
    EnumColor prevColor = color;
    TeleporterFrequency freq = getFrequency(FrequencyType.TELEPORTER);
    color = freq != null ? freq.getColor() : null;
    if (shouldRender != prevShouldRender) {
        // This also means the comparator output changed so notify the neighbors we have a change
        WorldUtils.notifyLoadedNeighborsOfTileChange(level, getBlockPos());
        sendUpdatePacket();
    } else if (color != prevColor) {
        sendUpdatePacket();
    }
    teleDelay = Math.max(0, teleDelay - 1);
    energySlot.fillContainerOrConvert();
}
Also used : EnumColor(mekanism.api.text.EnumColor) TeleporterFrequency(mekanism.common.content.teleporter.TeleporterFrequency)

Example 2 with TeleporterFrequency

use of mekanism.common.content.teleporter.TeleporterFrequency 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 TeleporterFrequency

use of mekanism.common.content.teleporter.TeleporterFrequency 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 TeleporterFrequency

use of mekanism.common.content.teleporter.TeleporterFrequency 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 5 with TeleporterFrequency

use of mekanism.common.content.teleporter.TeleporterFrequency 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

TeleporterFrequency (mekanism.common.content.teleporter.TeleporterFrequency)7 ComputerMethod (mekanism.common.integration.computer.annotation.ComputerMethod)4 WrappingComputerMethod (mekanism.common.integration.computer.annotation.WrappingComputerMethod)4 IEnergyContainer (mekanism.api.energy.IEnergyContainer)2 ComputerException (mekanism.common.integration.computer.ComputerException)2 Coord4D (mekanism.api.Coord4D)1 FloatingLong (mekanism.api.math.FloatingLong)1 EnumColor (mekanism.api.text.EnumColor)1 IBarInfoHandler (mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler)1 GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)1 TranslationButton (mekanism.client.gui.element.button.TranslationButton)1 GuiTeleporterStatus (mekanism.client.gui.element.custom.GuiTeleporterStatus)1 ItemPortableTeleporter (mekanism.common.item.ItemPortableTeleporter)1 FrequencyIdentity (mekanism.common.lib.frequency.Frequency.FrequencyIdentity)1 PacketPortalFX (mekanism.common.network.to_client.PacketPortalFX)1 TileEntityTeleporter (mekanism.common.tile.TileEntityTeleporter)1 ServerPlayerEntity (net.minecraft.entity.player.ServerPlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 BlockPos (net.minecraft.util.math.BlockPos)1 World (net.minecraft.world.World)1