Search in sources :

Example 1 with BoxIterator

use of buildcraft.lib.misc.data.BoxIterator in project BuildCraft by BuildCraft.

the class TileQuarry method getDebugInfo.

@Override
public void getDebugInfo(List<String> left, List<String> right, EnumFacing side) {
    left.add("battery = " + battery.getDebugString());
    left.add("rate = " + LocaleUtil.localizeMjFlow(debugPowerRate));
    left.add("frameBox");
    left.add(" - min = " + frameBox.min());
    left.add(" - max = " + frameBox.max());
    left.add("miningBox:");
    left.add(" - min = " + miningBox.min());
    left.add(" - max = " + miningBox.max());
    left.add("firstCheckedPoses = " + firstCheckedPoses.size());
    left.add("frameBoxPosesCount = " + frameBoxPosesCount);
    BoxIterator iter = boxIterator;
    left.add("current = " + (iter == null ? "null" : iter.getCurrent()));
    Task task = currentTask;
    if (task != null) {
        left.add("task:");
        left.add(" - class = " + task.getClass().getName());
        left.add(" - power = " + LocaleUtil.localizeMj(task.power));
        left.add(" - target = " + LocaleUtil.localizeMj(task.getTarget()));
    } else {
        left.add("task = null");
    }
    left.add("drill = " + drillPos);
}
Also used : BoxIterator(buildcraft.lib.misc.data.BoxIterator)

Example 2 with BoxIterator

use of buildcraft.lib.misc.data.BoxIterator in project BuildCraft by BuildCraft.

the class TileArchitectTable method scanSingleBlock.

private void scanSingleBlock() {
    BlockPos size = box.size();
    if (templateScannedBlocks == null || blueprintScannedData == null) {
        boxIterator = new BoxIterator(box, EnumAxisOrder.XZY.getMinToMaxOrder(), true);
        templateScannedBlocks = new BitSet(Snapshot.getDataSize(size));
        blueprintScannedData = new int[Snapshot.getDataSize(size)];
    }
    // Read from world
    BlockPos worldScanPos = boxIterator.getCurrent();
    BlockPos schematicPos = worldScanPos.subtract(box.min());
    if (snapshotType == EnumSnapshotType.TEMPLATE) {
        templateScannedBlocks.set(Snapshot.posToIndex(box.size(), schematicPos), !world.isAirBlock(worldScanPos));
    }
    if (snapshotType == EnumSnapshotType.BLUEPRINT) {
        ISchematicBlock schematicBlock = readSchematicBlock(worldScanPos);
        int index = blueprintScannedPalette.indexOf(schematicBlock);
        if (index == -1) {
            index = blueprintScannedPalette.size();
            blueprintScannedPalette.add(schematicBlock);
        }
        blueprintScannedData[Snapshot.posToIndex(box.size(), schematicPos)] = index;
    }
    createAndSendMessage(NET_SCAN, buffer -> MessageUtil.writeBlockPos(buffer, worldScanPos));
    sendNetworkUpdate(NET_RENDER_DATA);
    // Move scanPos along
    boxIterator.advance();
    if (boxIterator.hasFinished()) {
        scanning = false;
        boxIterator = null;
    }
}
Also used : ISchematicBlock(buildcraft.api.schematics.ISchematicBlock) BoxIterator(buildcraft.lib.misc.data.BoxIterator) BitSet(java.util.BitSet) BlockPos(net.minecraft.util.math.BlockPos) Blueprint(buildcraft.builders.snapshot.Blueprint)

Aggregations

BoxIterator (buildcraft.lib.misc.data.BoxIterator)2 ISchematicBlock (buildcraft.api.schematics.ISchematicBlock)1 Blueprint (buildcraft.builders.snapshot.Blueprint)1 BitSet (java.util.BitSet)1 BlockPos (net.minecraft.util.math.BlockPos)1