Search in sources :

Example 1 with MapLocationType

use of buildcraft.api.items.IMapLocation.MapLocationType 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)

Aggregations

IBox (buildcraft.api.core.IBox)1 MapLocationType (buildcraft.api.items.IMapLocation.MapLocationType)1 LaserData_BC8 (buildcraft.lib.client.render.laser.LaserData_BC8)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1 Vec3d (net.minecraft.util.math.Vec3d)1