Package mrtjp.projectred.integration

Source Code of mrtjp.projectred.integration.ArrayCommons

package mrtjp.projectred.integration;

import codechicken.lib.vec.*;
import codechicken.multipart.TMultiPart;
import codechicken.multipart.TileMultipart;
import mrtjp.projectred.core.libmc.PRLib;

public class ArrayCommons
{
    public static Cuboid6[][] oBoxes = new Cuboid6[6][2];
    public static Cuboid6[] cBoxes = new Cuboid6[6];

    static
    {
        oBoxes[0][0] = new Cuboid6(1/8D, 0, 0, 7/8D, 6/8D, 1);
        oBoxes[0][1] = new Cuboid6(0, 0, 1/8D, 1, 6/8D, 7/8D);
        cBoxes[0] = new Cuboid6(0, 0, 0, 1, 6/8D, 1);
        for (int s = 1; s < 6; s++)
        {
            Transformation t = Rotation.sideRotations[s].at(Vector3.center);
            oBoxes[s][0] = oBoxes[0][0].copy().apply(t);
            oBoxes[s][1] = oBoxes[0][1].copy().apply(t);
            cBoxes[s] = cBoxes[0].copy().apply(t);
        }
    }

    public static interface ITopArrayWire
    {
    }

    public static byte topWireConn(GatePart g)
    {
        byte i = 0;
        for (int r = 1; r < 4; r += 2)
            if (topWireConn(g, g.toAbsolute(r)))
                i |= 1 << r;

        return i;
    }

    private static boolean topWireConn(GatePart g, int r)
    {
        int absDir = Rotation.rotateSide(g.side(), r);

        BlockCoord pos = new BlockCoord(g.tile()).offset(absDir);
        TileMultipart t = PRLib.getMultipartTile(g.world(), pos);
        if (t != null)
        {
            TMultiPart tp = t.partMap(g.side());
            if (tp instanceof ITopArrayWire)
            {
                int a_r = ((GatePart) tp).rotation();
                return (a_r & 1) == (g.rotation() & 1);
            }
        }

        return false;
    }
}
TOP

Related Classes of mrtjp.projectred.integration.ArrayCommons

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.
ww.google-analytics.com/analytics.js','ga'); ga('create', 'UA-20639858-1', 'auto'); ga('send', 'pageview');