Search in sources :

Example 6 with SignalAspect

use of mods.railcraft.api.signals.SignalAspect in project Railcraft by Railcraft.

the class TESRSignalBox method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileBoxBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
    super.renderTileEntityAt(tile, x, y, z, partialTicks, destroyStage);
    // Aspect
    for (EnumFacing side : EnumFacing.HORIZONTALS) {
        SignalAspect aspect = tile.getBoxSignalAspect(side).getDisplayAspect();
        TextureAtlasSprite texture = RenderTools.getTexture(BlockMachineSignalBox.lampTextures[aspect.getTextureIndex()]);
        lampInfo.setTexture(side, texture);
        lampInfo.glow = !aspect.isOffState();
        lampInfo.setRenderSide(side, !tile.isConnected(side));
    }
    doRenderAspect(x, y, z);
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing)

Example 7 with SignalAspect

use of mods.railcraft.api.signals.SignalAspect in project Railcraft by Railcraft.

the class TESRSignalLamp method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileSignalBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
    EnumFacing side = tile.getFacing();
    SignalAspect aspect = tile.getSignalAspect().getDisplayAspect();
    TextureAtlasSprite texture = RenderTools.getTexture(BlockMachineSignalBox.lampTextures[aspect.getTextureIndex()]);
    lampInfo.setTexture(side, texture);
    lampInfo.lightSource = aspect.getTextureBrightness();
    doRenderAspect(x, y, z);
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) EnumFacing(net.minecraft.util.EnumFacing)

Example 8 with SignalAspect

use of mods.railcraft.api.signals.SignalAspect in project Railcraft by Railcraft.

the class GuiAspectAction method onButtonPressed.

protected void onButtonPressed(GuiButton button) {
    if (button.id <= 4) {
        SignalAspect aspect = SignalAspect.VALUES[button.id];
        aspects[aspect.ordinal()] = !aspects[aspect.ordinal()];
        ((GuiToggleButton) button).active = aspects[aspect.ordinal()];
    }
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect)

Example 9 with SignalAspect

use of mods.railcraft.api.signals.SignalAspect in project Railcraft by Railcraft.

the class TileBoxController method update.

@Override
public void update() {
    super.update();
    if (Game.isClient(worldObj)) {
        controller.tickClient();
        return;
    }
    controller.tickServer();
    SignalAspect prevAspect = controller.getAspect();
    if (controller.isBeingPaired())
        controller.setAspect(SignalAspect.BLINK_YELLOW);
    else if (controller.isPaired())
        controller.setAspect(determineAspect());
    else
        controller.setAspect(SignalAspect.BLINK_RED);
    if (prevAspect != controller.getAspect())
        sendUpdateToClient();
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect)

Example 10 with SignalAspect

use of mods.railcraft.api.signals.SignalAspect in project Railcraft by Railcraft.

the class TileBoxReceiver method update.

@Override
public void update() {
    super.update();
    if (Game.isClient(getWorld())) {
        receiver.tickClient();
        return;
    }
    receiver.tickServer();
    SignalAspect prevAspect = receiver.getAspect();
    if (receiver.isBeingPaired())
        receiver.setAspect(SignalAspect.BLINK_YELLOW);
    else if (!receiver.isPaired())
        receiver.setAspect(SignalAspect.BLINK_RED);
    if (prevAspect != receiver.getAspect() || clock % FORCED_UPDATE == 0) {
        updateNeighbors();
        sendUpdateToClient();
    }
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect)

Aggregations

SignalAspect (mods.railcraft.api.signals.SignalAspect)14 EnumFacing (net.minecraft.util.EnumFacing)5 BitSet (java.util.BitSet)4 EnumMap (java.util.EnumMap)4 Map (java.util.Map)4 TileEntity (net.minecraft.tileentity.TileEntity)3 IDualHeadSignal (mods.railcraft.common.blocks.wayobjects.IDualHeadSignal)2 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)2 IOException (java.io.IOException)1 List (java.util.List)1 IOwnable (mods.railcraft.api.core.IOwnable)1 TileMultiBlock (mods.railcraft.common.blocks.machine.TileMultiBlock)1 MultiBlockStateReturn (mods.railcraft.common.blocks.machine.TileMultiBlock.MultiBlockStateReturn)1 TileSignalBase (mods.railcraft.common.blocks.wayobjects.TileSignalBase)1 PacketGuiReturn (mods.railcraft.common.util.network.PacketGuiReturn)1 GuiTextField (net.minecraft.client.gui.GuiTextField)1 EnumActionResult (net.minecraft.util.EnumActionResult)1