本文整理汇总了Java中org.bukkit.util.NumberConversions.floor方法的典型用法代码示例。如果您正苦于以下问题:Java NumberConversions.floor方法的具体用法?Java NumberConversions.floor怎么用?Java NumberConversions.floor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.util.NumberConversions
的用法示例。
在下文中一共展示了NumberConversions.floor方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: fixXAxis
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
public static double fixXAxis(double x) {
/* For Z axis, just use Math.round(xaxis); */
double touchedX = x;
double rem = touchedX - Math.round(touchedX) + 0.01D;
if (rem < 0.30D) {
touchedX = NumberConversions.floor(x) - 1;
}
return touchedX;
}
示例2: fixXAxis
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
public static double fixXAxis(double x) {
double touchedX = x;
double rem = touchedX - (double)Math.round(touchedX) + 0.01;
if (rem < 0.3) {
touchedX = NumberConversions.floor((double)x) - 1;
}
return touchedX;
}
示例3: fixXAxis
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Fixes a player's X position to determine the block they are on, even if they're on the edge
*
* @param x player's x position
* @return fixed x position
*/
public static double fixXAxis(double x) {
/* For Z axis, just use Math.round(xaxis); */
double touchedX = x;
double rem = touchedX - Math.round(touchedX) + 0.01D;
if (rem < 0.30D) {
touchedX = NumberConversions.floor(x) - 1;
}
return touchedX;
}
示例4: locToBlock
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Safely converts a double (location coordinate) to an int (block
* coordinate)
*
* @param loc Precise coordinate
* @return Block coordinate
*/
public static int locToBlock(double loc) {
return NumberConversions.floor(loc);
}
示例5: getBlockX
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Returns the {@code x} component floored (rounded down).
*
* @return {@code x} component.
*/
public int getBlockX() {
return NumberConversions.floor(this.x);
}
示例6: getBlockY
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Returns the {@code y} component floored (rounded down).
*
* @return {@code y} component.
*/
public int getBlockY() {
return NumberConversions.floor(this.y);
}
示例7: getBlockZ
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Returns the {@code z} component floored (rounded down).
*
* @return {@code z} component.
*/
public int getBlockZ() {
return NumberConversions.floor(this.z);
}
示例8: locToBlock
import org.bukkit.util.NumberConversions; //导入方法依赖的package包/类
/**
* Safely converts a double (location coordinate) to an int (block coordinate)
*
* @param loc Precise coordinate
* @return Block coordinate
*/
public static int locToBlock(double loc) {
return NumberConversions.floor(loc);
}