Package buildcraft.api.blueprints

Examples of buildcraft.api.blueprints.SchematicBlock


    if (c == null) {
      return null;
    }
   
    try {
      SchematicBlock s = (SchematicBlock) c.newInstance();
      s.block = block;
      return s;
    } catch (IllegalAccessException e) {
      e.printStackTrace();
    } catch (IllegalArgumentException e) {
View Full Code Here


            continue;
          }

          if (!clearedLocations.contains(new BlockIndex(
                  xCoord, yCoord, zCoord))) {
            SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];

            if (slot == null && !blueprint.excavate) {
              continue;
            }

            if (slot == null) {
              slot = new SchematicBlock();
              slot.meta = 0;
              slot.block = Blocks.air;
            }

            if (!SchematicRegistry.INSTANCE.isAllowedForBuilding(slot.block, slot.meta)) {
              continue;
            }

            BuildingSlotBlock b = new BuildingSlotBlock();
            b.schematic = slot;
            b.x = xCoord;
            b.y = yCoord;
            b.z = zCoord;
            b.mode = Mode.ClearIfInvalid;
            b.buildStage = 0;

            buildList.add(b);
          }

        }
      }
    }

    LinkedList<BuildingSlotBlock> tmpStandalone = new LinkedList<BuildingSlotBlock>();
    LinkedList<BuildingSlotBlock> tmpSupported = new LinkedList<BuildingSlotBlock>();
    LinkedList<BuildingSlotBlock> tmpExpanding = new LinkedList<BuildingSlotBlock>();

    for (int j = 0; j < blueprint.sizeY; ++j) {
      for (int i = 0; i < blueprint.sizeX; ++i) {
        for (int k = 0; k < blueprint.sizeZ; ++k) {
          int xCoord = i + x - blueprint.anchorX;
          int yCoord = j + y - blueprint.anchorY;
          int zCoord = k + z - blueprint.anchorZ;

          SchematicBlock slot = (SchematicBlock) blueprint.contents[i][j][k];

          if (slot == null || yCoord < 0 || yCoord >= context.world.getHeight()) {
            continue;
          }

          if (!SchematicRegistry.INSTANCE.isAllowedForBuilding(slot.block, slot.meta)) {
            continue;
          }

          BuildingSlotBlock b = new BuildingSlotBlock();
          b.schematic = slot;
          b.x = xCoord;
          b.y = yCoord;
          b.z = zCoord;
          b.mode = Mode.Build;

          if (!builtLocations.contains(new BlockIndex(xCoord, yCoord,
                zCoord))) {
            switch (slot.getBuildStage()) {
            case STANDALONE:
              tmpStandalone.add(b);
              b.buildStage = 1;
              break;
            case SUPPORTED:
View Full Code Here

      // the registry, there can be other blocks considered as air. This
      // will make sure that they don't get recorded.
      return;
    }

    SchematicBlock slot = SchematicRegistry.INSTANCE.createSchematicBlock(block, meta);

    if (slot == null) {
      return;
    }

    int posX = (int) (x - context.surroundingBox().pMin().x);
    int posY = (int) (y - context.surroundingBox().pMin().y);
    int posZ = (int) (z - context.surroundingBox().pMin().z);

    slot.block = block;
    slot.meta = meta;

    if (!SchematicRegistry.INSTANCE.isSupported(block, meta)) {
      return;
    }

    try {
      slot.initializeFromObjectAt(context, x, y, z);
      slot.storeRequirements(context, x, y, z);
      contents[posX][posY][posZ] = slot;
    } catch (Throwable t) {
      // Defensive code against errors in implementers
      t.printStackTrace();
      BCLog.logger.throwing(t);
    }

    switch (slot.getBuildingPermission()) {
    case ALL:
      break;
    case CREATIVE_ONLY:
      if (bptContext.readConfiguration.allowCreative) {
        if (buildingPermission == BuildingPermission.ALL) {
View Full Code Here

      throws MappingNotFoundException {
    int blockId = nbt.getInteger("blockId");
    Block b = registry.getBlockForId(blockId);

    if (b == Blocks.air) {
      SchematicBlock s = new SchematicBlock();
      s.meta = 0;
      s.block = Blocks.air;

      return s;
    } else {
      SchematicBlock s = SchematicRegistry.INSTANCE.createSchematicBlock(b, nbt.getInteger("blockMeta"));

      if (s != null) {
        s.readSchematicFromNBT(nbt, registry);
        return s;
      }
    }

    return null;
View Full Code Here

TOP

Related Classes of buildcraft.api.blueprints.SchematicBlock

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.