Java Code Examples for com.sk89q.worldedit.math.BlockVector2#getBlockZ()

The following examples show how to use com.sk89q.worldedit.math.BlockVector2#getBlockZ() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RegionCommand.java    From uSkyBlock with GNU General Public License v3.0 6 votes vote down vote up
private void showChunk(Player player, BlockVector2 chunk) {
    World world = player.getWorld();
    int y = player.getLocation().getBlockY();
    List<Location> points = new ArrayList<>();
    int px = chunk.getBlockX() << 4;
    int pz = chunk.getBlockZ() << 4;
    for (int x = 0; x <= 15; x+=dash) {
        points.add(new Location(world, px+x+0.5d, y, pz+0.5d));
    }
    for (int z = 0; z <= 15; z+=dash) {
        points.add(new Location(world, px+15+0.5d, y, pz+z+0.5d));
    }
    for (int x = 15; x >= 0; x-=dash) {
        points.add(new Location(world, px+x+0.5d, y, pz+15+0.5d));
    }
    for (int z = 15; z >= 0; z-=dash) {
        points.add(new Location(world, px+0.5d, y, pz+z+0.5d));
    }
    addAnimation(player, points);
}
 
Example 2
Source File: ChunkComparator.java    From uSkyBlock with GNU General Public License v3.0 5 votes vote down vote up
@Override
public int compare(BlockVector2 o1, BlockVector2 o2) {
    int cmp = (int) Math.round(origin.distanceSq(o1) -  origin.distanceSq(o2));
    if (cmp == 0) {
        cmp = o1.getBlockX() - o2.getBlockX();
    }
    if (cmp == 0) {
        cmp = o1.getBlockZ() - o2.getBlockZ();
    }
    return cmp;
}
 
Example 3
Source File: SetBiomeTask.java    From uSkyBlock with GNU General Public License v3.0 4 votes vote down vote up
@Override
protected boolean execute() {
    if (minP == null || maxP == null) {
        return true;
    }
    Iterator<BlockVector2> it = chunks.iterator();
    while (it.hasNext()) {
        BlockVector2 chunk = it.next();
        it.remove();
        world.loadChunk(chunk.getBlockX(), chunk.getBlockZ());
        int cx = chunk.getBlockX() << 4;
        int cz = chunk.getBlockZ() << 4;
        int mx = cx + 15;
        int mz = cz + 15;
        if (cx < minP.getBlockX()) {
            cx = minP.getBlockX();
        }
        if (cz < minP.getBlockZ()) {
            cz = minP.getBlockZ();
        }
        if (mx > maxP.getBlockX()) {
            mx = maxP.getBlockX();
        }
        if (mz > maxP.getBlockZ()) {
            mz = maxP.getBlockZ();
        }
        for (int x = cx; x <= mx; x++) {
            for (int z = cz; z <= mz; z++) {
                for (int y = 0; y < world.getMaxHeight(); y++) {
                    world.setBiome(x, y, z, biome);
                }
            }
        }

        //noinspection deprecation
        world.refreshChunk(chunk.getBlockX(), chunk.getBlockZ());

        if (!tick()) {
            return isDone();
        }
    }
    return isDone();
}