當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。