Examples of ITrackSwitch


Examples of mods.railcraft.api.tracks.ITrackSwitch

            vertY4++;
        }

        if (track != null) {
            if (track instanceof ITrackSwitch) {
                ITrackSwitch switchTrack = (ITrackSwitch) track;
                if (switchTrack.isMirrored()) {
                    float temp = minU;
                    minU = maxU;
                    maxU = temp;
                    temp = minV;
                    minV = maxV;
View Full Code Here

Examples of mods.railcraft.api.tracks.ITrackSwitch

    @Override
    public void renderBlock(RenderBlocks renderblocks, IBlockAccess world, int x, int y, int z, Block block) {
//        BlockSignal structure = (BlockSignal)block;
        TileSwitchBase tile = (TileSwitchBase) world.getTileEntity(x, y, z);
        ITrackSwitch track = null;
        boolean powered = false;
        int facing = 0;
        if (tile != null) {
            track = tile.getSwitchTrack();
            facing = tile.getFacing();
            powered = tile.isPowered();
        }

        setTextureCore();

        // Core
        float f = 4.0F * PIX;
        float f1 = 12.0F * PIX;
        info.setBlockBounds(f, 0.0F, f, f1, 5.0F * PIX, f1);
        RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);

        // Post
        f = 7.0F * PIX;
        f1 = 9.0F * PIX;
        info.setBlockBounds(f, 0.0F, f, f1, 8.0F * PIX, f1);
        RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
        info.setBlockBounds(f, 11.0F * PIX, f, f1, 12.0F * PIX, f1);
        RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);

        // Extensions
        setTextureExtension();
        if (facing == 2 || facing == 3) {
            info.setBlockBounds(5.99F * PIX, 0.0F, 0.0F, 10.01F * PIX, 3.01F * PIX, 1.0F);
            RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
        } else {
            info.setBlockBounds(0.0F, 0.0F, 5.99F * PIX, 1.0F, 3.01F * PIX, 10.01F * PIX);
            RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
        }
//        if (type == EnumSignal.SWITCH_ROUTING) {
//            if (facing == 2 || facing == 3) {
//                info.setBlockBounds(0.0F, 0.0F, 5.99F * PIX, 1.0F, 3.01F * PIX, 10.01F * PIX);
//                RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
//            } else {
//                info.setBlockBounds(5.99F * PIX, 0.0F, 2F * PIX, 10.01F * PIX, 3.01F * PIX, 1.0F);
//                RenderFakeBlock.renderAsBlock(info, renderblocks, world, x, y, z);
//            }
//        }

        // Targets

        if (track == null) {
            setTextureWhite();
            renderTargetNorthSouth(renderblocks, world, x, y, z);
            setTextureRed();
            renderTargetEastWest(renderblocks, world, x, y, z);
            return;
        }


        setTextureWhite();
        ArrowDirection whiteArrow = track.getWhiteSignDirection();
        renderTarget(whiteArrow, renderblocks, world, x, y, z);

        setTextureRed();
        ArrowDirection redArrow = track.getRedSignDirection();
        renderTarget(redArrow, renderblocks, world, x, y, z);

        if (type == EnumSignal.SWITCH_LEVER)
            renderLever(x, y, z, facing, powered);
    }
View Full Code Here

Examples of mods.railcraft.api.tracks.ITrackSwitch

    }

    @Override
    public void updateEntity() {
        super.updateEntity();
        ITrackSwitch track = getSwitchTrack();

        if (track == null)
            return;
        boolean isSwitched = track.isSwitched();
        if (lastSwitchState != isSwitched) {
            lastSwitchState = isSwitched;
            if (isSwitched)
                SoundHelper.playSound(worldObj, getX(), getY(), getZ(), "tile.piston.in", 0.25f, worldObj.rand.nextFloat() * 0.25F + 0.7F);
            else
View Full Code Here

Examples of mods.railcraft.api.tracks.ITrackSwitch

    protected boolean isBeingPoweredByRedstone() {
        return PowerPlugin.isBlockBeingPowered(worldObj, xCoord, yCoord, zCoord) || PowerPlugin.isRedstonePowered(worldObj, xCoord, yCoord, zCoord);
    }

    public boolean isSwitched() {
        ITrackSwitch track = getSwitchTrack();
        if (track == null)
            return false;
        return track.isSwitched();
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.