Package com.sk89q.worldedit

Examples of com.sk89q.worldedit.CuboidClipboard$CopiedEntity


            BlockVector vec = new BlockVector(x, y, z);
            tileEntitiesMap.put(vec, values);
        }

        Vector size = new Vector(width, height, length);
        CuboidClipboard clipboard = new CuboidClipboard(size);
        clipboard.setOrigin(origin);
        clipboard.setOffset(offset);

        for (int x = 0; x < width; ++x) {
            for (int y = 0; y < height; ++y) {
                for (int z = 0; z < length; ++z) {
                    int index = y * width * length + z * width + x;
                    BlockVector pt = new BlockVector(x, y, z);
                    BaseBlock block = getBlockForId(blocks[index], blockData[index]);

                    if (tileEntitiesMap.containsKey(pt)) {
                        block.setNbtData(new CompoundTag(tileEntitiesMap.get(pt)));
                    }
                    clipboard.setBlock(pt, block);
                }
            }
        }

        return clipboard;
View Full Code Here


    private CuboidClipboard clipboard;

    public MCEditCuboidCopy(Vector origin, Vector size, World world) {

        super(origin, size, world);
        clipboard = new CuboidClipboard(size, origin);
    }
View Full Code Here

      broadcastLocation = metaYaml.getBoolean(tagBroadcastLocation, broadcastLocation);
      decayable = metaYaml.getBoolean(tagDecayable, decayable);
    }
   
    // load the actual blocks
    CuboidClipboard cuboid = SchematicFormat.getFormat(file).load(file);
   
    // how big is it?
    sizeX = cuboid.getWidth();
    sizeZ = cuboid.getLength();
    sizeY = cuboid.getHeight();
   
    //TODO Validate the size
   
    // try and save the meta data if we can
    try {
      metaYaml.save(metaFile);
    } catch (IOException e) {
     
      // we can recover from this... so eat it!
      generator.reportException("[WorldEdit] Could not resave " + metaFile.getAbsolutePath(), e);
    }
   
    // grab the edge block
    BaseBlock edge = cuboid.getBlock(new Vector(0, groundLevelY, 0));
    edgeType = edge.getType();
    edgeData = edge.getData();
    edgeRise = BlackMagic.getMaterialId(generator.oreProvider.surfaceMaterial) == edgeType ? 0 : 1;
   
    // allocate the blocks
    facingCount = 1;
    if (flipableX)
      facingCount *= 2;
    if (flipableZ)
      facingCount *= 2;
   
    //TODO we should allocate only facing count, then allocate the size based on what comes out of the rotation.. once I do rotation
    // allocate room
    blocks = new BaseBlock[facingCount][sizeX][sizeY][sizeZ];
   
    // copy the cubes for each direction
    copyCuboid(cuboid, 0); // normal one
    if (flipableX) {
      cuboid.flip(FlipDirection.WEST_EAST);
      copyCuboid(cuboid, 1);
     
      // z too? if so then make two more copies
      if (flipableZ) {
        cuboid.flip(FlipDirection.NORTH_SOUTH);
        copyCuboid(cuboid, 3);
        cuboid.flip(FlipDirection.WEST_EAST);
        copyCuboid(cuboid, 2);
      }
   
    // just z
    } else if (flipableZ) {
      cuboid.flip(FlipDirection.NORTH_SOUTH);
      copyCuboid(cuboid, 1);
    }
  }
View Full Code Here

TOP

Related Classes of com.sk89q.worldedit.CuboidClipboard$CopiedEntity

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.