本文整理汇总了Java中com.sk89q.worldedit.Vector2D.getBlockX方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2D.getBlockX方法的具体用法?Java Vector2D.getBlockX怎么用?Java Vector2D.getBlockX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.Vector2D
的用法示例。
在下文中一共展示了Vector2D.getBlockX方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: add
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
public void add(Vector2D pos1, Vector2D pos2) {
int ccx1 = pos1.getBlockX() >> 9;
int ccz1 = pos1.getBlockZ() >> 9;
int ccx2 = pos2.getBlockX() >> 9;
int ccz2 = pos2.getBlockZ() >> 9;
for (int x = ccx1; x <= ccx2; x++) {
for (int z = ccz1; z <= ccz2; z++) {
if (!occupiedRegions.containsKey(x, z)) {
occupiedRegions.add(x, z);
int bcx = x << 5;
int bcz = z << 5;
int tcx = bcx + 32;
int tcz = bcz + 32;
for (int cz = bcz; cz < tcz; cz++) {
for (int cx = bcx; cx < tcx; cx++) {
unoccupiedChunks.add(cx, cz);
}
}
}
}
}
int cx1 = pos1.getBlockX() >> 4;
int cz1 = pos1.getBlockZ() >> 4;
int cx2 = pos2.getBlockX() >> 4;
int cz2 = pos2.getBlockZ() >> 4;
for (int cz = cz1; cz <= cz2; cz++) {
for (int cx = cx1; cx <= cx2; cx++) {
unoccupiedChunks.remove(cx, cz);
}
}
}
示例2: apply
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public boolean apply(Vector2D position) throws WorldEditException {
int x = position.getBlockX();
int z = position.getBlockZ();
int layer = extent.getNearestSurfaceTerrainBlock(x, z, lastY, minY, maxY);
if (layer != -1) {
lastY = layer;
return function.apply(mutable.setComponents(x, layer, z));
}
return false;
}
示例3: generateChunk
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public void generateChunk(Vector2D adjacentChunk, Vector2D originChunk, Extent chunk) throws WorldEditException {
PseudoRandom random = getRandom();
int i = random.nextInt(random.nextInt(random.nextInt(this.caveFrequency) + 1) + 1);
if (this.evenCaveDistribution)
i = this.caveFrequency;
if (random.nextInt(100) >= this.caveRarity)
i = 0;
for (int j = 0; j < i; j++) {
double x = (adjacentChunk.getBlockX() << 4) + random.nextInt(16);
double y;
if (this.evenCaveDistribution)
y = random.nextInt(this.caveMinAltitude, this.caveMaxAltitude);
else
y = random.nextInt(random.nextInt(this.caveMaxAltitude - this.caveMinAltitude + 1) + 1) + this.caveMinAltitude;
double z = (adjacentChunk.getBlockZ() << 4) + random.nextInt(16);
int count = this.caveSystemFrequency;
boolean largeCaveSpawned = false;
if (random.nextInt(100) <= this.individualCaveRarity) {
generateLargeCaveNode(random.nextLong(), originChunk, chunk, x, y, z);
largeCaveSpawned = true;
}
if ((largeCaveSpawned) || (random.nextInt(100) <= this.caveSystemPocketChance - 1)) {
count += random.nextInt(this.caveSystemPocketMinSize, this.caveSystemPocketMaxSize);
}
while (count > 0) {
count--;
double f1 = random.nextDouble() * 3.141593F * 2.0F;
double f2 = (random.nextDouble() - 0.5F) * 2.0F / 8.0F;
double f3 = random.nextDouble() * 2.0F + random.nextDouble();
generateCaveNode(random.nextLong(), originChunk, chunk, x, y, z, f3, f1, f2, 0, 0, 1.0D);
}
}
}
示例4: generate
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
public void generate(Vector2D chunkPos, Extent chunk) throws WorldEditException {
int i = this.checkAreaSize;
int chunkX = chunkPos.getBlockX();
int chunkZ = chunkPos.getBlockZ();
for (int x = chunkX - i; x <= chunkX + i; x++) {
mutable.mutX(x);
for (int z = chunkZ - i; z <= chunkZ + i; z++) {
mutable.mutZ(z);
this.random.setSeed(worldSeed1 * x ^ worldSeed2 * z ^ seed);
generateChunk(mutable, chunkPos, chunk);
}
}
}
示例5: spawnResource
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
default public void spawnResource(Region region, Resource gen, int rarity, int frequency) throws WorldEditException {
PseudoRandom random = new PseudoRandom();
for (Vector2D chunkPos : region.getChunks()) {
for (int i = 0; i < frequency; i++) {
if (random.nextInt(100) > rarity) {
continue;
}
int x = (chunkPos.getBlockX() << 4) + PseudoRandom.random.nextInt(16);
int z = (chunkPos.getBlockZ() << 4) + PseudoRandom.random.nextInt(16);
gen.spawn(random, x, z);
}
}
}
示例6: setBiome
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public boolean setBiome(Vector2D position, BaseBiome biome) {
int x = position.getBlockX() - mx;
int z = position.getBlockZ() - mz;
IMP.setBiome(x, z, biome.getId());
return true;
}
示例7: setBiome
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public boolean setBiome(Vector2D pos, BaseBiome biome) {
int x = pos.getBlockX() + random.nextInt(1 + (dx << 1)) - dx;
int z = pos.getBlockZ() + random.nextInt(1 + (dz << 1)) - dz;
return getExtent().setBiome(mutable.setComponents(x, z), biome);
}
示例8: iterator
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public Iterator<Vector2D> iterator() {
if (queue == null || Settings.IMP.QUEUE.PRELOAD_CHUNKS <= 1) {
return (Iterator<Vector2D>) iterable.iterator();
}
return new Iterator<Vector2D>() {
Iterator<? extends Vector2D> trailIter = iterable.iterator();
Iterator<? extends Vector2D> leadIter = iterable.iterator();
int lastTrailChunkX = Integer.MIN_VALUE;
int lastTrailChunkZ = Integer.MIN_VALUE;
int lastLeadChunkX = Integer.MIN_VALUE;
int lastLeadChunkZ = Integer.MIN_VALUE;
int loadingTarget = Settings.IMP.QUEUE.PRELOAD_CHUNKS;
int cx, cz;
@Override
public void remove() {
trailIter.remove();
}
@Override
public boolean hasNext() {
return trailIter.hasNext();
}
@Override
public Vector2D next() {
Vector2D pt = trailIter.next();
if (lastTrailChunkX != (lastTrailChunkX = pt.getBlockX() >> 4) || lastTrailChunkZ != (lastTrailChunkZ = pt.getBlockZ() >> 4)) {
if (leadIter.hasNext()) {
try {
int amount;
if (lastLeadChunkX == Integer.MIN_VALUE) {
lastLeadChunkX = cx;
lastLeadChunkZ = cz;
amount = loadingTarget;
} else {
amount = 1;
}
for (int count = 0; count < amount; ) {
Vector2D v = leadIter.next();
int vcx = v.getBlockX() >> 4;
int vcz = v.getBlockZ() >> 4;
if (vcx != lastLeadChunkX || vcz != lastLeadChunkZ) {
lastLeadChunkX = vcx;
lastLeadChunkZ = vcz;
queue.queueChunkLoad(vcx, vcz);
count++;
}
}
} catch (Throwable ignore) {
}
}
}
return pt;
}
};
}
示例9: HeightMap
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
public HeightMap(EditSession session, Region region, boolean naturalOnly, boolean layers) {
checkNotNull(session);
checkNotNull(region);
this.session = session;
this.region = region;
this.width = region.getWidth();
this.height = region.getLength();
this.layers = layers;
int minX = region.getMinimumPoint().getBlockX();
int minY = region.getMinimumPoint().getBlockY();
int minZ = region.getMinimumPoint().getBlockZ();
int maxY = region.getMaximumPoint().getBlockY();
data = new int[width * height];
invalid = new boolean[data.length];
if (layers) {
Vector min = region.getMinimumPoint();
Vector max = region.getMaximumPoint();
int bx = min.getBlockX();
int bz = min.getBlockZ();
Iterable<Vector2D> flat = Regions.asFlatRegion(region).asFlatRegion();
Iterator<Vector2D> iter = new Fast2DIterator(flat, session).iterator();
int y = 0;
MutableBlockVector mutable = new MutableBlockVector();
while (iter.hasNext()) {
Vector2D pos = iter.next();
int x = pos.getBlockX();
int z = pos.getBlockZ();
y = session.getNearestSurfaceLayer(x, z, y, 0, maxY);
data[(z - bz) * width + (x - bx)] = y;
}
} else {
// Store current heightmap data
int index = 0;
if (naturalOnly) {
for (int z = 0; z < height; ++z) {
for (int x = 0; x < width; ++x, index++) {
data[index] = session.getHighestTerrainBlock(x + minX, z + minZ, minY, maxY, naturalOnly);
}
}
} else {
int yTmp = 255;
for (int z = 0; z < height; ++z) {
for (int x = 0; x < width; ++x, index++) {
yTmp = session.getNearestSurfaceTerrainBlock(x + minX, z + minZ, yTmp, minY, maxY, Integer.MIN_VALUE, Integer.MAX_VALUE);
switch (yTmp) {
case Integer.MIN_VALUE:
yTmp = minY;
invalid[index] = true;
break;
case Integer.MAX_VALUE:
yTmp = maxY;
invalid[index] = true;
break;
}
data[index] = yTmp;
}
}
}
}
}
示例10: getBiome
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
int x = position.getBlockX() - mx;
int z = position.getBlockZ() - mz;
return IMP.getBiome(x, z);
}