Search in sources :

Example 66 with Pos

use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.

the class Cube method recalc.

/**
 * Called after the cube's data has changed in order
 * to update any internal data.
 */
protected void recalc() {
    if (pointOne != null && pointTwo != null) {
        lowerPoint = new Pos(Math.min(pointOne.x(), pointTwo.x()), Math.min(pointOne.y(), pointTwo.y()), Math.min(pointOne.z(), pointTwo.z()));
        higherPoint = new Pos(Math.max(pointOne.x(), pointTwo.x()), Math.max(pointOne.y(), pointTwo.y()), Math.max(pointOne.z(), pointTwo.z()));
        this.center = new Pos(min().x() + (getSizeX() / 2), min().y() + (getSizeY() / 2), min().z() + (getSizeZ() / 2));
    } else {
        this.center = null;
    }
}
Also used : Pos(com.builtbroken.mc.lib.transform.vector.Pos)

Example 67 with Pos

use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.

the class Cube method getCorners.

public static IPos3D[] getCorners(Cube box) {
    IPos3D[] array = new IPos3D[8];
    if (box.isValid()) {
        double l = box.pointTwo.x() - box.pointOne.x();
        double w = box.pointTwo.z() - box.pointOne.z();
        double h = box.pointTwo.y() - box.pointOne.y();
        array[0] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z());
        array[1] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z());
        array[2] = new Pos(box.pointOne.x(), box.pointOne.y() + h, box.pointOne.z() + w);
        array[3] = new Pos(box.pointOne.x(), box.pointOne.y(), box.pointOne.z() + w);
        array[4] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z());
        array[5] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z());
        array[6] = new Pos(box.pointOne.x() + l, box.pointOne.y() + h, box.pointOne.z() + w);
        array[7] = new Pos(box.pointOne.x() + l, box.pointOne.y(), box.pointOne.z() + w);
    }
    return array;
}
Also used : IPos3D(com.builtbroken.jlib.data.vector.IPos3D) Pos(com.builtbroken.mc.lib.transform.vector.Pos)

Example 68 with Pos

use of com.builtbroken.mc.lib.transform.vector.Pos in project Engine by VoltzEngine-Project.

the class Cube method add.

public Cube add(double x, double y, double z) {
    if (isValid()) {
        pointOne = new Pos(pointOne.x() + x, pointOne.y() + y, pointOne.z() + z);
        pointTwo = new Pos(pointTwo.x() + x, pointTwo.y() + y, pointTwo.z() + z);
        recalc();
    }
    return this;
}
Also used : Pos(com.builtbroken.mc.lib.transform.vector.Pos)

Aggregations

Pos (com.builtbroken.mc.lib.transform.vector.Pos)68 Block (net.minecraft.block.Block)11 TileEntity (net.minecraft.tileentity.TileEntity)8 ForgeDirection (net.minecraftforge.common.util.ForgeDirection)8 FakeWorld (com.builtbroken.mc.testing.junit.world.FakeWorld)7 Cube (com.builtbroken.mc.lib.transform.region.Cube)6 Test (org.junit.Test)6 IPos3D (com.builtbroken.jlib.data.vector.IPos3D)5 BlockEdit (com.builtbroken.mc.lib.world.edit.BlockEdit)5 ArrayList (java.util.ArrayList)5 HashMap (java.util.HashMap)5 Vector3DistanceComparator (com.builtbroken.mc.lib.transform.sorting.Vector3DistanceComparator)4 BlockTile (com.builtbroken.mc.prefab.tile.BlockTile)4 Tile (com.builtbroken.mc.prefab.tile.Tile)4 EntityPlayer (net.minecraft.entity.player.EntityPlayer)4 World (net.minecraft.world.World)4 Pair (com.builtbroken.jlib.type.Pair)3 PacketTile (com.builtbroken.mc.core.network.packet.PacketTile)3 Quaternion (com.builtbroken.mc.lib.transform.rotation.Quaternion)3 AbstractTest (com.builtbroken.mc.testing.junit.AbstractTest)3