use of buildcraft.core.blueprints.BptBuilderBlueprint in project BuildCraft by BuildCraft.
the class RealBlueprintDeployer method deployBlueprint.
public void deployBlueprint(World world, BlockPos pos, EnumFacing dir, Blueprint bpt) {
bpt.id = new LibraryId();
bpt.id.extension = "bpt";
BptContext context = bpt.getContext(world, bpt.getBoxForPos(pos));
if (bpt.rotate) {
if (dir == EnumFacing.EAST) {
// Do nothing
} else if (dir == EnumFacing.SOUTH) {
bpt.rotateLeft(context);
} else if (dir == EnumFacing.WEST) {
bpt.rotateLeft(context);
bpt.rotateLeft(context);
} else if (dir == EnumFacing.NORTH) {
bpt.rotateLeft(context);
bpt.rotateLeft(context);
bpt.rotateLeft(context);
}
}
Vec3d transform = Utils.convert(pos).subtract(Utils.convert(bpt.anchor));
bpt.translateToWorld(transform);
new BptBuilderBlueprint(bpt, world, pos).deploy();
}
use of buildcraft.core.blueprints.BptBuilderBlueprint in project BuildCraft by BuildCraft.
the class TileBuilder method updateRequirements.
private void updateRequirements() {
List<RequirementItemStack> reqCopy = null;
if (currentBuilder instanceof BptBuilderBlueprint) {
currentBuilder.initialize();
reqCopy = ((BptBuilderBlueprint) currentBuilder).getNeededItems();
}
for (EntityPlayer p : guiWatchers) {
BuildCraftCore.instance.sendToPlayer(p, getItemRequirementsPacket(reqCopy));
}
}
use of buildcraft.core.blueprints.BptBuilderBlueprint 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();
}
use of buildcraft.core.blueprints.BptBuilderBlueprint 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;
}
}
use of buildcraft.core.blueprints.BptBuilderBlueprint in project BuildCraft by BuildCraft.
the class TileBuilder method instanciateBluePrintBuilder.
@Deprecated
public BptBuilderBase instanciateBluePrintBuilder(BlockPos pos, EnumFacing o) {
BlueprintBase bpt = instanciateBlueprint();
if (bpt == null) {
return null;
}
bpt = bpt.adjustToWorld(worldObj, pos, o);
if (bpt != null) {
if (getStackInSlot(0).getItem() instanceof ItemBlueprintStandard) {
return new BptBuilderBlueprint((Blueprint) bpt, worldObj, pos);
} else if (getStackInSlot(0).getItem() instanceof ItemBlueprintTemplate) {
return new BptBuilderTemplate(bpt, worldObj, pos);
}
}
return null;
}
Aggregations