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


Java Vector.getBlockX方法代码示例

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


在下文中一共展示了Vector.getBlockX方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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;
}
 
开发者ID:funkemunky,项目名称:HCFCore,代码行数:30,代码来源:Cuboid.java

示例2: BlockRegion

import org.bukkit.util.Vector; //导入方法依赖的package包/类
public BlockRegion(Vector block) {
    this.location = new Vector(block.getBlockX(), block.getBlockY(), block.getBlockZ());
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:4,代码来源:BlockRegion.java

示例3: 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();
}
 
开发者ID:OvercastNetwork,项目名称:ProjectAres,代码行数:7,代码来源:BlockRegion.java

示例4: 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;
	}
 
开发者ID:Maximuspayne,项目名称:NavyCraft2-Lite,代码行数:82,代码来源:CraftRotator.java


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