本文整理汇总了Java中com.sk89q.worldedit.Vector2D.getX方法的典型用法代码示例。如果您正苦于以下问题:Java Vector2D.getX方法的具体用法?Java Vector2D.getX怎么用?Java Vector2D.getX使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sk89q.worldedit.Vector2D
的用法示例。
在下文中一共展示了Vector2D.getX方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getBiome
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public BaseBiome getBiome(Vector2D position) {
if (position.getX() == bx && position.getZ() == bz) {
return biome;
}
return super.getBiome(position);
}
示例2: getChunks
import com.sk89q.worldedit.Vector2D; //导入方法依赖的package包/类
@Override
public Set<Vector2D> getChunks() {
Vector min = getMinimumPoint();
Vector max = getMaximumPoint();
final int maxX = max.getBlockX() >> ChunkStore.CHUNK_SHIFTS;
final int minX = min.getBlockX() >> ChunkStore.CHUNK_SHIFTS;
final int maxZ = max.getBlockZ() >> ChunkStore.CHUNK_SHIFTS;
final int minZ = min.getBlockZ() >> ChunkStore.CHUNK_SHIFTS;
final int size = (maxX - minX + 1) * (maxZ - minZ + 1);
return new AbstractSet<Vector2D>() {
@Override
public Iterator<Vector2D> iterator() {
return new Iterator<Vector2D>() {
private MutableBlockVector2D pos = new MutableBlockVector2D().setComponents(maxX + 1, maxZ);
@Override
public boolean hasNext() {
return pos != null;
}
@Override
public Vector2D next() {
Vector2D result = pos;
// calc next
pos.setComponents(pos.getX() - 1, pos.getZ());
if (pos.getX() <= minX) {
if (pos.getZ() == minZ) {
pos = null;
} else if (pos.getX() < minX) {
pos.setComponents(maxX, pos.getZ() - 1);
}
}
return result;
}
@Override
public void remove() {
throw new UnsupportedOperationException("This set is immutable.");
}
};
}
@Override
public int size() {
return size;
}
@Override
public boolean contains(Object o) {
if (o instanceof Vector2D) {
Vector2D cv = (Vector2D) o;
return cv.getX() >= minX && cv.getX() <= maxX && cv.getZ() >= minZ && cv.getZ() <= maxZ;
} else {
return false;
}
}
};
}