当前位置: 首页>>代码示例>>Java>>正文


Java Vector.getBlockZ方法代码示例

本文整理汇总了Java中com.sk89q.worldedit.Vector.getBlockZ方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.getBlockZ方法的具体用法?Java Vector.getBlockZ怎么用?Java Vector.getBlockZ使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.sk89q.worldedit.Vector的用法示例。


在下文中一共展示了Vector.getBlockZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: ascendUpwards

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean ascendUpwards(int distance, boolean alwaysGlass) {
    final Vector pos = getBlockIn();
    final int x = pos.getBlockX();
    final int initialY = Math.max(0, pos.getBlockY());
    int y = Math.max(0, pos.getBlockY() + 1);
    final int z = pos.getBlockZ();
    final int maxY = Math.min(getWorld().getMaxY() + 1, initialY + distance);
    final World world = getPosition().getWorld();

    while (y <= world.getMaxY() + 2) {
        if (!BlockType.canPassThrough(world.getBlock(new Vector(x, y, z)))) {
            break; // Hit something
        } else if (y > maxY + 1) {
            break;
        } else if (y == maxY + 1) {
            floatAt(x, y - 1, z, alwaysGlass);
            return true;
        }

        ++y;
    }

    return false;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:26,代码来源:PlayerWrapper.java

示例2: contains

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean contains(Vector position) {
    int cx = position.getBlockX() - center.getBlockX();
    int cx2 = cx * cx;
    if (cx2 > radiusSqr.getBlockX()) {
        return false;
    }
    int cz = position.getBlockZ() - center.getBlockZ();
    int cz2 = cz * cz;
    if (cz2 > radiusSqr.getBlockZ()) {
        return false;
    }
    int cy = position.getBlockY() - center.getBlockY();
    int cy2 = cy * cy;
    if (radiusSqr.getBlockY() < 255 && cy2 > radiusSqr.getBlockY()) {
        return false;
    }
    if (sphere) {
        return cx2 + cy2 + cz2 <= radiusLengthSqr;
    }
    double cxd = (double) cx / radius.getBlockX();
    double cyd = (double) cy / radius.getBlockY();
    double czd = (double) cz / radius.getBlockZ();
    return cxd * cxd + cyd * cyd + czd * czd <= 1;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:26,代码来源:EllipsoidRegion.java

示例3: getSlope

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public int getSlope(BaseBlock block, Vector vector) {
    int slope = super.getSlope(block, vector);
    if (slope != -1) {
        int x = vector.getBlockX();
        int y = vector.getBlockY();
        int z = vector.getBlockZ();
        int height = extent.getNearestSurfaceTerrainBlock(x, z, y, 0, maxY);
        if (height > 0) {
            BaseBlock below = extent.getLazyBlock(x, height - 1, z);
            if (FaweCache.canPassThrough(block.getId(), block.getData())) {
                return Integer.MAX_VALUE;
            }
        }
    }
    return slope;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:18,代码来源:AngleColorPattern.java

示例4: isVisitable

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean isVisitable(final Vector from, final Vector to) {
    int dx = to.getBlockX() - from.getBlockX();
    int dz = to.getBlockZ() - from.getBlockZ();
    int dy = to.getBlockY() - from.getBlockY();

    if (dx != 0) {
        if (dirVec.getBlockX() != 0 && dirVec.getBlockX() != dx) {
            return false;
        }
    }
    if (dy != 0) {
        if (dirVec.getBlockY() != 0 && dirVec.getBlockY() != dy) {
            return false;
        }
    }
    if (dz != 0) {
        if (dirVec.getBlockZ() != 0 && dirVec.getBlockZ() != dz) {
            return false;
        }
    }
    return super.isVisitable(from, to);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:24,代码来源:DirectionalVisitor.java

示例5: contains

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean contains(Vector position) {
    if (!isDefined()) {
        return false;
    }
    final int x = position.getBlockX();
    final int y = position.getBlockY();
    final int z = position.getBlockZ();
    final Vector min = getMinimumPoint();
    final Vector max = getMaximumPoint();
    if (x < min.getBlockX()) return false;
    if (x > max.getBlockX()) return false;
    if (z < min.getBlockZ()) return false;
    if (z > max.getBlockZ()) return false;
    if (y < min.getBlockY()) return false;
    if (y > max.getBlockY()) return false;
    return containsRaw(position);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:19,代码来源:PolyhedralRegion.java

示例6: test

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean test(Vector to) {
    if (pos == null) {
        pos = new MutableBlockVector(to);
    }
    int dx = pos.getBlockX() - to.getBlockX();
    int d = dx * dx;
    if (d > maxSqr) {
        return false;
    }
    int dz = pos.getBlockZ() - to.getBlockZ();
    d += dz * dz;
    if (d > maxSqr) {
        return false;
    }
    int dy = pos.getBlockY() - to.getBlockY();
    d += dy * dy;
    if (d < minSqr || d > maxSqr) {
        return false;
    }
    return true;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:23,代码来源:RadiusMask.java

示例7: placeBuildPlan2D

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
/**Places the given material where the plan is true, starting from the given relative origin within this module.
 * The plan and origin are rotated beforehand, to avoid conversion toGlobal for each block!
 * @param origin	A relative coordinate specifying the minimum Point of the given build plan
 * @param plan		A grid of boolean values. Material is set if true at that position.
 * @param m			The Material to be placed.
 * @param height	How high the plan should be duplicated. (stacked up)
 */
public void placeBuildPlan2D(Vector origin, boolean[][] plan, Material m, int height) {
	plan = Helper.rotateBoolMatrixClockw(plan, turnedBy); //clockwise turning as is defined in mc for sky directions
	// The origin has to be at another corner of the matrix now:
	origin = toGlobal(origin);
	switch (turnedBy) {
	case 0:
		break;
	case 90:
		origin = origin.add(-(plan.length-1), 0, 0);
		break;
	case 180:
		origin = origin.add(-(plan.length-1),0,-(plan[0].length-1));
		break;
	case 270:
		origin = origin.add(0, 0, -(plan[0].length-1));
		break;
	default:
		parent.setStateAndNotify(State.ERROR, "Module: turnedBy is out of range: " + turnedBy + ". Plan is not placed.");
		return;
	}
	
	// now we have a building plan matrix looking east, with the origin in the lower left. Easy:
	int x = origin.getBlockX();
	for (int row=0; row < plan.length; row++, x++) {
		int z = origin.getBlockZ();
		for (int col=0; col< plan[0].length; col++, z++)
			for (int y = origin.getBlockY(); y < (origin.getBlockY()+height); y++)
				if (plan[row][col]) parent.world.getBlockAt(x,y,z).setType(m);	
	}
		
}
 
开发者ID:TheRoot89,项目名称:DungeonGen,代码行数:39,代码来源:Module.java

示例8: getRelPos

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
private Vector getRelPos(PacketEvent event, HeightMapMCAGenerator generator) {
    PacketContainer packet = event.getPacket();
    StructureModifier<BlockPosition> position = packet.getBlockPositionModifier();
    BlockPosition loc = position.readSafely(0);
    if (loc == null) return null;
    Vector origin = generator.getOrigin();
    Vector pt = new Vector(loc.getX() - origin.getBlockX(), loc.getY() - origin.getBlockY(), loc.getZ() - origin.getBlockZ());
    return pt;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:CFIPacketListener.java

示例9: setBlock

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
public static boolean setBlock(Level level, Vector pos, BaseBlock block) {
    int x = pos.getBlockX();
    int y = pos.getBlockY();
    int z = pos.getBlockZ();
    level.setBlockIdAt(x, y, z, block.getId());
    level.setBlockDataAt(x, y, z, block.getData());
    return true;

}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:10,代码来源:NukkitUtil.java

示例10: build

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public void build(EditSession editSession, Vector position, Pattern pattern, double size) throws MaxChangedBlocksException {
    double seedX = ThreadLocalRandom.current().nextDouble();
    double seedY = ThreadLocalRandom.current().nextDouble();
    double seedZ = ThreadLocalRandom.current().nextDouble();

    int px = position.getBlockX();
    int py = position.getBlockY();
    int pz = position.getBlockZ();

    double distort = this.frequency / size;

    double modX = 1d/radius.getX();
    double modY = 1d/radius.getY();
    double modZ = 1d/radius.getZ();

    int radiusSqr = (int) (size * size);
    int sizeInt = (int) size * 2;
    for (int x = -sizeInt; x <= sizeInt; x++) {
        double nx = seedX + x * distort;
        double d1 = x * x * modX;
        for (int y = -sizeInt; y <= sizeInt; y++) {
            double d2 = d1 + y * y * modY;
            double ny = seedY + y * distort;
            for (int z = -sizeInt; z <= sizeInt; z++) {
                double nz = seedZ + z * distort;
                double distance = d2 + z * z * modZ;
                double noise = this.amplitude * SimplexNoise.noise(nx, ny, nz);
                if (distance + distance * noise < radiusSqr) {
                    editSession.setBlock(px + x, py + y, pz + z, pattern);
                }
            }
        }
    }
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:36,代码来源:RockBrush.java

示例11: WorldCopyClipboard

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
public WorldCopyClipboard(EditSession editSession, Region region, boolean hasEntities, boolean hasBiomes) {
    super(region);
    this.hasBiomes = hasBiomes;
    this.hasEntities = hasEntities;
    final Vector origin = region.getMinimumPoint();
    this.mx = origin.getBlockX();
    this.my = origin.getBlockY();
    this.mz = origin.getBlockZ();
    this.editSession = editSession;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:WorldCopyClipboard.java

示例12: apply

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean apply(Extent extent, Vector set, Vector get) throws WorldEditException {
    if (set.getBlockX() == get.getBlockX() && set.getBlockZ() == get.getBlockZ() && set.getBlockY() == get.getBlockY()) {
        return false;
    }
    return extent.setBlock(set, extent.getBlock(get));
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:ExistingPattern.java

示例13: apply

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public BaseBlock apply(Vector position) {
    int index = (position.getBlockX() + position.getBlockY() + position.getBlockZ()) % patternsArray.length;
    if (index < 0) {
        index += patternsArray.length;
    }
    return patternsArray[index].apply(position);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:9,代码来源:Linear3DBlockPattern.java

示例14: getBlock

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public BaseBlock getBlock(Vector position) {
    if (region.contains(position)) {
        int x = position.getBlockX() - mx;
        int y = position.getBlockY() - my;
        int z = position.getBlockZ() - mz;
        return IMP.getBlock(x, y, z);
    }
    return EditSession.nullBlock;
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:11,代码来源:BlockArrayClipboard.java

示例15: setBlock

import com.sk89q.worldedit.Vector; //导入方法依赖的package包/类
@Override
public boolean setBlock(Vector pos, BaseBlock block) throws WorldEditException {
    int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
    int y = pos.getBlockY() + random.nextInt(1 + (dy << 1)) - dy;
    int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
    return getExtent().setBlock(x, y, z, block);
}
 
开发者ID:boy0001,项目名称:FastAsyncWorldedit,代码行数:8,代码来源:RandomOffsetTransform.java


注:本文中的com.sk89q.worldedit.Vector.getBlockZ方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。