本文整理匯總了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;
}
示例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;
}
示例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;
}
示例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);
}
示例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);
}
示例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;
}
示例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);
}
}
示例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;
}
示例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;
}
示例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);
}
}
}
}
}
示例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;
}
示例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));
}
示例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);
}
示例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;
}
示例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);
}