Search in sources :

Example 1 with Blueprint

use of buildcraft.core.blueprints.Blueprint in project BuildCraft by BuildCraft.

the class PatternQuarryFrame method getBlueprint.

public Blueprint getBlueprint(Box box, World world) {
    Blueprint result = new Blueprint(box.size());
    int x = box.size().getX() - 1;
    int y = box.size().getY() - 1;
    int z = box.size().getZ() - 1;
    for (int d = 1; d < x; d++) {
        result.set(new BlockPos(d, 0, 0), EFrameConnection.EAST_WEST.getSchematic());
        result.set(new BlockPos(d, 0, z), EFrameConnection.EAST_WEST.getSchematic());
        result.set(new BlockPos(d, y, 0), EFrameConnection.EAST_WEST.getSchematic());
        result.set(new BlockPos(d, y, z), EFrameConnection.EAST_WEST.getSchematic());
    }
    for (int d = 1; d < y; d++) {
        result.set(new BlockPos(0, d, 0), EFrameConnection.UP_DOWN.getSchematic());
        result.set(new BlockPos(0, d, z), EFrameConnection.UP_DOWN.getSchematic());
        result.set(new BlockPos(x, d, 0), EFrameConnection.UP_DOWN.getSchematic());
        result.set(new BlockPos(x, d, z), EFrameConnection.UP_DOWN.getSchematic());
    }
    for (int d = 1; d < z; d++) {
        result.set(new BlockPos(0, 0, d), EFrameConnection.NORTH_SOUTH.getSchematic());
        result.set(new BlockPos(0, y, d), EFrameConnection.NORTH_SOUTH.getSchematic());
        result.set(new BlockPos(x, 0, d), EFrameConnection.NORTH_SOUTH.getSchematic());
        result.set(new BlockPos(x, y, d), EFrameConnection.NORTH_SOUTH.getSchematic());
    }
    result.set(new BlockPos(0, 0, 0), EFrameConnection.SOUTH_EAST_UP.getSchematic());
    result.set(new BlockPos(0, 0, z), EFrameConnection.NORTH_EAST_UP.getSchematic());
    result.set(new BlockPos(x, 0, 0), EFrameConnection.SOUTH_WEST_UP.getSchematic());
    result.set(new BlockPos(x, 0, z), EFrameConnection.NORTH_WEST_UP.getSchematic());
    result.set(new BlockPos(0, y, 0), EFrameConnection.SOUTH_EAST_DOWN.getSchematic());
    result.set(new BlockPos(0, y, z), EFrameConnection.NORTH_EAST_DOWN.getSchematic());
    result.set(new BlockPos(x, y, 0), EFrameConnection.SOUTH_WEST_DOWN.getSchematic());
    result.set(new BlockPos(x, y, z), EFrameConnection.NORTH_WEST_DOWN.getSchematic());
    return result;
}
Also used : Blueprint(buildcraft.core.blueprints.Blueprint) BlockPos(net.minecraft.util.math.BlockPos) Blueprint(buildcraft.core.blueprints.Blueprint)

Example 2 with Blueprint

use of buildcraft.core.blueprints.Blueprint in project BuildCraft by BuildCraft.

the class ItemBlueprint method loadBlueprint.

public static BlueprintBase loadBlueprint(ItemStack stack) {
    if (stack == null || stack.getItem() == null || !(stack.getItem() instanceof IBlueprintItem)) {
        return null;
    }
    LibraryId id = getId(stack);
    if (id == null) {
        return null;
    }
    NBTTagCompound nbt = BuildCraftBuilders.serverDB.load(id);
    BlueprintBase base;
    if (((IBlueprintItem) stack.getItem()).getType(stack) == EnumBlueprintType.TEMPLATE) {
        base = new Template();
    } else {
        base = new Blueprint();
    }
    base.readFromNBT(nbt);
    base.id = id;
    return base;
}
Also used : BlueprintBase(buildcraft.core.blueprints.BlueprintBase) LibraryId(buildcraft.core.blueprints.LibraryId) Blueprint(buildcraft.core.blueprints.Blueprint) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) IBlueprintItem(buildcraft.api.items.IBlueprintItem) Template(buildcraft.core.blueprints.Template)

Example 3 with Blueprint

use of buildcraft.core.blueprints.Blueprint in project BuildCraft by BuildCraft.

the class TileQuarry method initializeBlueprintBuilder.

private void initializeBlueprintBuilder() {
    PatternQuarryFrame pqf = PatternQuarryFrame.INSTANCE;
    Blueprint bpt = pqf.getBlueprint(box, worldObj);
    builder = new BptBuilderBlueprint(bpt, worldObj, box.min());
    builder.setOrder(new AxisOrder(EnumAxisOrder.XZY, true, true, false));
    speed = 0;
    stage = Stage.BUILDING;
    sendNetworkUpdate();
}
Also used : Blueprint(buildcraft.core.blueprints.Blueprint) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) EnumAxisOrder(buildcraft.lib.misc.data.EnumAxisOrder) AxisOrder(buildcraft.lib.misc.data.AxisOrder) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint)

Example 4 with Blueprint

use of buildcraft.core.blueprints.Blueprint 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)

Example 5 with Blueprint

use of buildcraft.core.blueprints.Blueprint in project BuildCraft by BuildCraft.

the class RecursiveBlueprintBuilder method nextBuilder.

public BptBuilderBase nextBuilder() {
    if (!returnedThis) {
        blueprint = blueprint.adjustToWorld(world, pos, dir);
        returnedThis = true;
        BptBuilderBase builder;
        if (blueprint instanceof Blueprint) {
            builder = new BptBuilderBlueprint((Blueprint) blueprint, world, pos);
        } else if (blueprint instanceof Template) {
            builder = new BptBuilderTemplate(blueprint, world, pos);
        } else {
            return null;
        }
        box.initialize(builder);
        return builder;
    }
    // Free memory associated with this blueprint
    blueprint = null;
    if (current != null) {
        BptBuilderBase builder = current.nextBuilder();
        if (builder != null) {
            return builder;
        }
    }
    if (nextSubBlueprint >= subBlueprints.size()) {
        return null;
    }
    NBTTagCompound nbt = subBlueprints.get(nextSubBlueprint);
    BlueprintBase bpt = BlueprintBase.loadBluePrint(nbt.getCompoundTag("bpt"));
    int nx = box.min().getX() + nbt.getInteger("x");
    int ny = box.min().getY() + nbt.getInteger("y");
    int nz = box.min().getZ() + nbt.getInteger("z");
    EnumFacing nbtDir = EnumFacing.values()[nbt.getByte("dir")];
    current = new RecursiveBlueprintBuilder(bpt, world, new BlockPos(nx, ny, nz), nbtDir);
    nextSubBlueprint++;
    return current.nextBuilder();
}
Also used : BlueprintBase(buildcraft.core.blueprints.BlueprintBase) BptBuilderBase(buildcraft.core.blueprints.BptBuilderBase) Blueprint(buildcraft.core.blueprints.Blueprint) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) EnumFacing(net.minecraft.util.EnumFacing) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) BlockPos(net.minecraft.util.math.BlockPos) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) BptBuilderTemplate(buildcraft.core.blueprints.BptBuilderTemplate) Blueprint(buildcraft.core.blueprints.Blueprint) BptBuilderBlueprint(buildcraft.core.blueprints.BptBuilderBlueprint) Template(buildcraft.core.blueprints.Template) BptBuilderTemplate(buildcraft.core.blueprints.BptBuilderTemplate)

Aggregations

Blueprint (buildcraft.core.blueprints.Blueprint)5 BlueprintBase (buildcraft.core.blueprints.BlueprintBase)3 BptBuilderBlueprint (buildcraft.core.blueprints.BptBuilderBlueprint)3 Template (buildcraft.core.blueprints.Template)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 BlockPos (net.minecraft.util.math.BlockPos)2 IBlueprintItem (buildcraft.api.items.IBlueprintItem)1 LaserData (buildcraft.core.LaserData)1 BptBuilderBase (buildcraft.core.blueprints.BptBuilderBase)1 BptBuilderTemplate (buildcraft.core.blueprints.BptBuilderTemplate)1 LibraryId (buildcraft.core.blueprints.LibraryId)1 BuildingItem (buildcraft.core.builders.BuildingItem)1 AxisOrder (buildcraft.lib.misc.data.AxisOrder)1 EnumAxisOrder (buildcraft.lib.misc.data.EnumAxisOrder)1 EnumFacing (net.minecraft.util.EnumFacing)1 Vec3d (net.minecraft.util.math.Vec3d)1