本文整理汇总了Java中org.bukkit.util.Vector.getBlockY方法的典型用法代码示例。如果您正苦于以下问题:Java Vector.getBlockY方法的具体用法?Java Vector.getBlockY怎么用?Java Vector.getBlockY使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.util.Vector
的用法示例。
在下文中一共展示了Vector.getBlockY方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: edges
import org.bukkit.util.Vector; //导入方法依赖的package包/类
public List<Vector> edges(final int fixedMinX, final int fixedMaxX, final int fixedMinZ, final int fixedMaxZ) {
final Vector v1 = this.getMinimumPoint().toVector();
final Vector v2 = this.getMaximumPoint().toVector();
final int minX = v1.getBlockX();
final int maxX = v2.getBlockX();
final int minZ = v1.getBlockZ();
final int maxZ = v2.getBlockZ();
int capacity = (maxX - minX) * 4 + (maxZ - minZ) * 4;
capacity += 4;
final List<Vector> result = new ArrayList<Vector>(capacity);
if (capacity <= 0) {
return result;
}
final int minY = v1.getBlockY();
final int maxY = v1.getBlockY();
for (int x = minX; x <= maxX; ++x) {
result.add(new Vector(x, minY, minZ));
result.add(new Vector(x, minY, maxZ));
result.add(new Vector(x, maxY, minZ));
result.add(new Vector(x, maxY, maxZ));
}
for (int z = minZ; z <= maxZ; ++z) {
result.add(new Vector(minX, minY, z));
result.add(new Vector(minX, maxY, z));
result.add(new Vector(maxX, minY, z));
result.add(new Vector(maxX, maxY, z));
}
return result;
}
示例2: isOnLine
import org.bukkit.util.Vector; //导入方法依赖的package包/类
public boolean isOnLine(Vector position) {
double t = (position.getX() - origin.getX()) / direction.getX();
return position.getBlockY() == origin.getY() + (t * direction.getY()) && position.getBlockZ() == origin.getZ() + (t * direction.getZ());
}
示例3: BlockRegion
import org.bukkit.util.Vector; //导入方法依赖的package包/类
public BlockRegion(Vector block) {
this.location = new Vector(block.getBlockX(), block.getBlockY(), block.getBlockZ());
}
示例4: contains
import org.bukkit.util.Vector; //导入方法依赖的package包/类
@Override
public boolean contains(Vector point) {
return this.location.getBlockX() == point.getBlockX() &&
this.location.getBlockY() == point.getBlockY() &&
this.location.getBlockZ() == point.getBlockZ();
}
示例5: canMoveBlocks
import org.bukkit.util.Vector; //导入方法依赖的package包/类
public boolean canMoveBlocks(int dx, int dy, int dz, int dr){
//new rotation of the craft
int newRotation = (dr + 360) % 360;
//rotate dimensions
Vector newSize = this.getCraftSize().clone();
if(dr == 90 ||dr == 270)
{
newSize.setX(this.getCraftSize().getZ());
newSize.setZ(this.getCraftSize().getX());
}
//new matrix
short newMatrix[][][] = new short[newSize.getBlockX()][newSize.getBlockY()][newSize.getBlockZ()];
//rotate matrix
for(int x=0; x < newSize.getBlockX(); x++){
for(int y=0; y < newSize.getBlockY(); y++){
for(int z=0; z < newSize.getBlockZ(); z++){
int newX = 0;
int newZ = 0;
if(dr == 90) {
newX = z;
newZ = newSize.getBlockX() - 1 - x;
} else if(dr == 270){
newX = newSize.getBlockZ() - 1 - z;
newZ = x;
} else {
newX = newSize.getBlockX() - 1 - x;
newZ = newSize.getBlockZ() - 1 - z;
}
newMatrix[x][y][z] = craft.matrix[newX][y][newZ];
}
}
}
//craft pivot
int posX = craft.minX + craft.offX;
int posZ = craft.minZ + craft.offZ;
int newoffsetX = rotateX(craft.offX, craft.offZ, dr);
int newoffsetZ = rotateZ(craft.offX, craft.offZ, dr);
if(newoffsetX < 0)
newoffsetX = newSize.getBlockX() - 1 - Math.abs(newoffsetX);
if(newoffsetZ < 0)
newoffsetZ = newSize.getBlockZ() - 1 - Math.abs(newoffsetZ);
//update min/max
int newminX, newminZ;
newminX = posX - newoffsetX;
newminZ = posZ - newoffsetZ;
for(int x=0;x<newSize.getBlockX();x++){
for(int z=0;z<newSize.getBlockZ();z++){
for(int y=0;y<newSize.getBlockY();y++){
//all blocks new craft.positions needs to have a free space before
if(newMatrix[x][y][z]!=255){ //before move : craft block
if(getCraftBlockId(x + dx + newminX, y + dy, z + dz + newminZ, dr) == 255){
if(!canGoThrough(getWorldBlockId(x + dx, y + dy, z + dz, newRotation, newminX, craft.minY, newminZ, newoffsetX, newoffsetZ))){
return false;
}
}
}
}
}
}
return true;
}