Package mods.railcraft.common.blocks.machine.alpha

Examples of mods.railcraft.common.blocks.machine.alpha.TileSteamTurbine


public class RenderTurbineGauge extends TileEntitySpecialRenderer {

    @Override
    public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float partialTicks) {
        TileSteamTurbine turbine = (TileSteamTurbine) tile;

        if (!turbine.isStructureValid()
                || turbine.getPatternMarker() != 'W')
            // not a gauge block
            return;

        double halfWidth = 0.5 / 16; // half width of the needle
        double len = 0.26; // length of the needle (along the center)
        double zOffset = 0.001; // offset to prevent z-fighting

        // average the value over time to smooth the needle
        double value = turbine.mainGauge = (turbine.mainGauge * 14.0 + turbine.getMainGauge()) / 15.0;

        // set the needle angle between 45° (= 0%) and 135° (= 100%)
        double angle = Math.toRadians(90 * value + 45);

        int fx = 0, fz = 0; // vector towards the front of the gauge
        int rx = 0, rz = 0; // vector to the right when looking at the gauge

        if (turbine.getPatternIndex() == 0) {
            if (turbine.getPatternPositionX() == 1) {
                fx = -1;
                rz = 1;
            } else if (turbine.getPatternPositionX() == 2) {
                x++;
                z++;
                fx = 1;
                rz = -1;
            }
        } else if (turbine.getPatternIndex() == 1)
            if (turbine.getPatternPositionZ() == 1) {
                x++;
                fz = -1;
                rx = -1;
            } else if (turbine.getPatternPositionZ() == 2) {
                z++;
                fz = 1;
                rx = 1;
            }

View Full Code Here

TOP

Related Classes of mods.railcraft.common.blocks.machine.alpha.TileSteamTurbine

Copyright © 2018 www.massapicom. 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.