Search in sources :

Example 6 with LaserData

use of buildcraft.core.LaserData in project BuildCraft by BuildCraft.

the class TileArchitect method addSubBlueprint.

private void addSubBlueprint(BlockPos index) {
    subBlueprints.add(index);
    Vec3d point5 = new Vec3d(0.5, 0.5, 0.5);
    LaserData laser = new LaserData(Utils.convert(index).add(point5), Utils.convert(this.getPos()).add(point5));
    subLasers.add(laser);
}
Also used : LaserData(buildcraft.core.LaserData) Vec3d(net.minecraft.util.math.Vec3d)

Example 7 with LaserData

use of buildcraft.core.LaserData in project BuildCraft by BuildCraft.

the class TileBuilder method createLasersForPath.

public void createLasersForPath() {
    pathLasers = new LinkedList<>();
    BlockPos previous = null;
    for (BlockPos b : path) {
        if (previous != null) {
            Vec3d point5 = new Vec3d(0.5, 0.5, 0.5);
            LaserData laser = new LaserData(Utils.convert(previous).add(point5), Utils.convert(b).add(point5));
            pathLasers.add(laser);
        }
        previous = b;
    }
}
Also used : BlockPos(net.minecraft.util.math.BlockPos) LaserData(buildcraft.core.LaserData) Vec3d(net.minecraft.util.math.Vec3d)

Example 8 with LaserData

use of buildcraft.core.LaserData in project BuildCraft by BuildCraft.

the class RenderBox method doRender.

public static void doRender(World world, TextureManager t, ResourceLocation texture, Box box) {
    Minecraft.getMinecraft().mcProfiler.startSection("box");
    Minecraft.getMinecraft().mcProfiler.startSection("prepare");
    GL11.glPushMatrix();
    GL11.glDisable(GL11.GL_LIGHTING);
    box.createLaserData();
    Minecraft.getMinecraft().mcProfiler.endStartSection("draw");
    for (LaserData l : box.lasersData) {
        // l.update();
        GL11.glPushMatrix();
        GL11.glTranslated(0.5F, 0.5F, 0.5F);
        RenderLaser.doRenderLaser(world, t, l, texture);
        GL11.glPopMatrix();
    }
    GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopMatrix();
    Minecraft.getMinecraft().mcProfiler.endSection();
    Minecraft.getMinecraft().mcProfiler.endSection();
}
Also used : LaserData(buildcraft.core.LaserData)

Example 9 with LaserData

use of buildcraft.core.LaserData in project BuildCraft by BuildCraft.

the class RenderBuilder method renderTileEntityAt.

@Override
public void renderTileEntityAt(B builder, double x, double y, double z, float f, int arg) {
    Minecraft.getMinecraft().mcProfiler.startSection("builder");
    super.renderTileEntityAt(builder, x, y, z, f, arg);
    GL11.glPushMatrix();
    GL11.glPushAttrib(GL11.GL_ENABLE_BIT);
    GlStateManager.enableCull();
    GlStateManager.enableLighting();
    GlStateManager.enableBlend();
    GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glTranslated(x, y, z);
    GL11.glTranslated(-builder.getPos().getX(), -builder.getPos().getY(), -builder.getPos().getZ());
    if (builder.getPathLaser() != null) {
        for (LaserData laser : builder.getPathLaser()) {
            if (laser != null) {
                GL11.glPushMatrix();
                RenderLaser.doRenderLaser(TileEntityRendererDispatcher.instance.worldObj, Minecraft.getMinecraft().getTextureManager(), laser, EntityLaser.LASER_STRIPES_YELLOW);
                GL11.glPopMatrix();
            }
        }
        Minecraft.getMinecraft().getTextureManager().bindTexture(TextureMap.locationBlocksTexture);
    }
    // GL11.glEnable(GL11.GL_LIGHTING);
    GL11.glPopAttrib();
    GL11.glPopMatrix();
    renderItems.render(builder, x, y, z);
    Minecraft.getMinecraft().mcProfiler.endSection();
}
Also used : LaserData(buildcraft.core.LaserData)

Example 10 with LaserData

use of buildcraft.core.LaserData in project BuildCraft by BuildCraft.

the class TileConstructionMarker method update.

@Override
public void update() {
    super.update();
    BuildingItem toRemove = null;
    for (BuildingItem i : buildersInAction) {
        i.update();
        if (i.isDone) {
            toRemove = i;
        }
    }
    if (toRemove != null) {
        buildersInAction.remove(toRemove);
    }
    if (worldObj.isRemote) {
        return;
    }
    if (itemBlueprint != null && ItemBlueprint.getId(itemBlueprint) != null && bluePrintBuilder == null) {
        BlueprintBase bpt = ItemBlueprint.loadBlueprint(itemBlueprint);
        if (bpt != null && bpt instanceof Blueprint) {
            bpt = bpt.adjustToWorld(worldObj, pos, direction);
            if (bpt != null) {
                bluePrintBuilder = new BptBuilderBlueprint((Blueprint) bpt, worldObj, pos);
                bptContext = bluePrintBuilder.getContext();
                box.initialize(bluePrintBuilder);
                sendNetworkUpdate();
            }
        } else {
            return;
        }
    }
    if (laser == null && direction != null) {
        Vec3d point5 = new Vec3d(0.5, 0.5, 0.5);
        laser = new LaserData();
        laser.head = Utils.convert(pos).add(point5);
        laser.tail = laser.head.add(Utils.convert(direction, 0.5));
        laser.isVisible = true;
        sendNetworkUpdate();
    }
    if (initNBT != null) {
        if (bluePrintBuilder != null) {
            bluePrintBuilder.loadBuildStateToNBT(initNBT.getCompoundTag("builderState"), this);
        }
        initNBT = null;
    }
}
Also used : BuildingItem(buildcraft.core.builders.BuildingItem) BlueprintBase(buildcraft.core.blueprints.BlueprintBase) Blueprint(buildcraft.core.blueprints.Blueprint) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) LaserData(buildcraft.core.LaserData) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) Vec3d(net.minecraft.util.math.Vec3d)

Aggregations

LaserData (buildcraft.core.LaserData)16 Vec3d (net.minecraft.util.math.Vec3d)3 Blueprint (buildcraft.core.blueprints.Blueprint)2 BptBuilderBlueprint (buildcraft.core.blueprints.BptBuilderBlueprint)2 BlueprintBase (buildcraft.core.blueprints.BlueprintBase)1 BuildingItem (buildcraft.core.builders.BuildingItem)1 Box (buildcraft.lib.misc.data.Box)1 BlockPos (net.minecraft.util.math.BlockPos)1