Search in sources :

Example 6 with BptBuilderBlueprint

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

BptBuilderBlueprint (buildcraft.core.blueprints.BptBuilderBlueprint)6 Blueprint (buildcraft.core.blueprints.Blueprint)3 BlueprintBase (buildcraft.core.blueprints.BlueprintBase)3 BptBuilderTemplate (buildcraft.core.blueprints.BptBuilderTemplate)2 Vec3d (net.minecraft.util.math.Vec3d)2 LaserData (buildcraft.core.LaserData)1 BptBuilderBase (buildcraft.core.blueprints.BptBuilderBase)1 BptContext (buildcraft.core.blueprints.BptContext)1 LibraryId (buildcraft.core.blueprints.LibraryId)1 RequirementItemStack (buildcraft.core.blueprints.RequirementItemStack)1 Template (buildcraft.core.blueprints.Template)1 BuildingItem (buildcraft.core.builders.BuildingItem)1 AxisOrder (buildcraft.lib.misc.data.AxisOrder)1 EnumAxisOrder (buildcraft.lib.misc.data.EnumAxisOrder)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1 EnumFacing (net.minecraft.util.EnumFacing)1 BlockPos (net.minecraft.util.math.BlockPos)1