Search in sources :

Example 1 with IBox

use of buildcraft.api.core.IBox in project BuildCraft by BuildCraft.

the class RenderTickListener method renderMapLocation.

private static void renderMapLocation(@Nonnull ItemStack stack) {
    MapLocationType type = MapLocationType.getFromStack(stack);
    if (type == MapLocationType.SPOT) {
        EnumFacing face = ItemMapLocation.getPointFace(stack);
        IBox box = ItemMapLocation.getPointBox(stack);
        if (box != null) {
            Vec3d[][] vectors = MAP_LOCATION_POINT[face.ordinal()];
            GL11.glTranslated(box.min().getX(), box.min().getY(), box.min().getZ());
            for (Vec3d[] vec : vectors) {
                LaserData_BC8 laser = new LaserData_BC8(BuildCraftLaserManager.STRIPES_WRITE, vec[0], vec[1], 1 / 16.0);
                LaserRenderer_BC8.renderLaserStatic(laser);
            }
        }
    } else if (type == MapLocationType.AREA) {
        IBox box = ItemMapLocation.getAreaBox(stack);
        LAST_RENDERED_MAP_LOC.reset();
        LAST_RENDERED_MAP_LOC.initialize(box);
        LaserBoxRenderer.renderLaserBoxStatic(LAST_RENDERED_MAP_LOC, BuildCraftLaserManager.STRIPES_WRITE, true);
    } else if (type == MapLocationType.PATH) {
        List<BlockPos> path = BCCoreItems.mapLocation.getPath(stack);
        if (path != null && path.size() > 1) {
            BlockPos last = null;
            for (BlockPos p : path) {
                if (last == null) {
                    last = p;
                }
            }
        }
    // TODO!
    } else if (type == MapLocationType.ZONE) {
    // TODO!
    }
}
Also used : IBox(buildcraft.api.core.IBox) MapLocationType(buildcraft.api.items.IMapLocation.MapLocationType) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) LaserData_BC8(buildcraft.lib.client.render.laser.LaserData_BC8) Vec3d(net.minecraft.util.math.Vec3d)

Example 2 with IBox

use of buildcraft.api.core.IBox in project BuildCraft by BuildCraft.

the class ItemMapLocation method getAreaBox.

public static IBox getAreaBox(@Nonnull ItemStack item) {
    NBTTagCompound cpt = NBTUtilBC.getItemData(item);
    int xMin = cpt.getInteger("xMin");
    int yMin = cpt.getInteger("yMin");
    int zMin = cpt.getInteger("zMin");
    BlockPos min = new BlockPos(xMin, yMin, zMin);
    int xMax = cpt.getInteger("xMax");
    int yMax = cpt.getInteger("yMax");
    int zMax = cpt.getInteger("zMax");
    BlockPos max = new BlockPos(xMax, yMax, zMax);
    return new Box(min, max);
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockPos(net.minecraft.util.math.BlockPos) Box(buildcraft.lib.misc.data.Box) IBox(buildcraft.api.core.IBox)

Example 3 with IBox

use of buildcraft.api.core.IBox in project BuildCraft by BuildCraft.

the class ItemMapLocation method getPointBox.

public static IBox getPointBox(@Nonnull ItemStack item) {
    NBTTagCompound cpt = NBTUtilBC.getItemData(item);
    MapLocationType type = MapLocationType.getFromStack(item);
    switch(type) {
        case SPOT:
            {
                int x = cpt.getInteger("x");
                int y = cpt.getInteger("y");
                int z = cpt.getInteger("z");
                BlockPos pos = new BlockPos(x, y, z);
                return new Box(pos, pos);
            }
        default:
            {
                return null;
            }
    }
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockPos(net.minecraft.util.math.BlockPos) Box(buildcraft.lib.misc.data.Box) IBox(buildcraft.api.core.IBox)

Aggregations

IBox (buildcraft.api.core.IBox)3 BlockPos (net.minecraft.util.math.BlockPos)3 Box (buildcraft.lib.misc.data.Box)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 MapLocationType (buildcraft.api.items.IMapLocation.MapLocationType)1 LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)1 EnumFacing (net.minecraft.util.EnumFacing)1 Vec3d (net.minecraft.util.math.Vec3d)1