Search in sources :

Example 1 with IDualHeadSignal

use of mods.railcraft.common.blocks.wayobjects.IDualHeadSignal in project Railcraft by Railcraft.

the class TESRSignalLampDual method renderTileEntityAt.

@Override
public void renderTileEntityAt(TileSignalBase te, double x, double y, double z, float partialTicks, int destroyStage) {
    super.renderTileEntityAt(te, x, y, z, partialTicks, destroyStage);
    if (!(te instanceof IDualHeadSignal)) {
        return;
    }
    IDualHeadSignal tile = (IDualHeadSignal) te;
    EnumFacing facing = tile.getFacing();
    SignalAspect aspect = tile.getSignalAspect(DualLamp.TOP).getDisplayAspect();
    lampInfo.setTexture(facing, tile.getLampTexture(DualLamp.TOP, aspect));
    lampInfo.lightSource = aspect.getTextureBrightness();
    doRenderAspect(x, y, z);
    lampInfo.resetSidesAndLight();
    aspect = tile.getSignalAspect(DualLamp.BOTTOM).getDisplayAspect();
    lampInfo.setTexture(facing, tile.getLampTexture(DualLamp.BOTTOM, aspect));
    lampInfo.lightSource = aspect.getTextureBrightness();
    doRenderAspect(x, y, z);
}
Also used : SignalAspect(mods.railcraft.api.signals.SignalAspect) IDualHeadSignal(mods.railcraft.common.blocks.wayobjects.IDualHeadSignal) EnumFacing(net.minecraft.util.EnumFacing)

Example 2 with IDualHeadSignal

use of mods.railcraft.common.blocks.wayobjects.IDualHeadSignal in project Railcraft by Railcraft.

the class ItemMagnifyingGlass method onItemUseFirst.

@Override
public EnumActionResult onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ, EnumHand hand) {
    if (Game.isClient(world))
        return EnumActionResult.PASS;
    TileEntity t = world.getTileEntity(pos);
    EnumActionResult returnValue = EnumActionResult.PASS;
    if (t instanceof IOwnable) {
        IOwnable ownable = (IOwnable) t;
        ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.mag.glass.placedby", ownable.getDisplayName(), ownable.getOwner());
        returnValue = EnumActionResult.SUCCESS;
    }
    if (t instanceof TileMultiBlock) {
        TileMultiBlock tile = (TileMultiBlock) t;
        if (tile.isStructureValid())
            ChatPlugin.sendLocalizedChatFromServer(player, "railcraft.multiblock.state.valid");
        else
            for (MultiBlockStateReturn returnState : EnumSet.complementOf(EnumSet.of(MultiBlockStateReturn.VALID))) {
                List<Integer> pats = tile.patternStates.get(returnState);
                if (!pats.isEmpty())
                    ChatPlugin.sendLocalizedChatFromServer(player, returnState.message, pats.toString());
            }
        returnValue = EnumActionResult.SUCCESS;
    }
    if (t instanceof IDualHeadSignal) {
        IDualHeadSignal signal = (IDualHeadSignal) t;
        SignalAspect top = signal.getSignalAspect(DualLamp.TOP);
        SignalAspect bottom = signal.getSignalAspect(DualLamp.BOTTOM);
        ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.mag.glass.aspect.dual", top.getLocalizationTag(), bottom.getLocalizationTag());
        returnValue = EnumActionResult.SUCCESS;
    } else if (t instanceof TileSignalBase) {
        ChatPlugin.sendLocalizedChatFromServer(player, "gui.railcraft.mag.glass.aspect", ((TileSignalBase) t).getSignalAspect().getLocalizationTag());
        returnValue = EnumActionResult.SUCCESS;
    }
    return returnValue;
}
Also used : TileEntity(net.minecraft.tileentity.TileEntity) SignalAspect(mods.railcraft.api.signals.SignalAspect) EnumActionResult(net.minecraft.util.EnumActionResult) TileMultiBlock(mods.railcraft.common.blocks.machine.TileMultiBlock) MultiBlockStateReturn(mods.railcraft.common.blocks.machine.TileMultiBlock.MultiBlockStateReturn) IDualHeadSignal(mods.railcraft.common.blocks.wayobjects.IDualHeadSignal) TileSignalBase(mods.railcraft.common.blocks.wayobjects.TileSignalBase) IOwnable(mods.railcraft.api.core.IOwnable) List(java.util.List)

Aggregations

SignalAspect (mods.railcraft.api.signals.SignalAspect)2 IDualHeadSignal (mods.railcraft.common.blocks.wayobjects.IDualHeadSignal)2 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 TileEntity (net.minecraft.tileentity.TileEntity)1 EnumActionResult (net.minecraft.util.EnumActionResult)1 EnumFacing (net.minecraft.util.EnumFacing)1