本文整理汇总了Java中org.bukkit.Material.LADDER属性的典型用法代码示例。如果您正苦于以下问题:Java Material.LADDER属性的具体用法?Java Material.LADDER怎么用?Java Material.LADDER使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.LADDER属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isClimbing
/**
* @return if we are climbing on ladder/vine.
*/
public static boolean isClimbing(Location location) {
boolean alreadyHasLadder = location.getBlock().getType() == Material.LADDER;
boolean alreadyHasVine = location.getBlock().getType() == Material.VINE;
if (alreadyHasLadder || alreadyHasVine) {
return true;
}
LocationBit bit = new LocationBit(0.1);
for (int i = 1; i <= 4; i++) {
Location newLocation = location.clone().add(bit.getX(), -0.06, bit.getZ());
Block block = newLocation.getBlock();
if (block.getType() == Material.LADDER || block.getType() == Material.VINE) {
return true;
}
bit.shift(i);
}
return false;
}
示例2: isCritical
/**
* Check if an attack was a critical.
*
* @param player the player
* @return true, if the attack was registered as a critical.
*/
public static boolean isCritical(Player player) {
boolean onGround = ((Entity) player).isOnGround();
return !onGround && player.getFallDistance() > 0.0F && !LocationHelper.isInLiquid(player.getLocation())
&& (player.getLocation().getBlock().getType() != Material.LADDER
|| player.getLocation().getBlock().getType() != Material.VINE)
&& player.getVehicle() == null && !player.hasPotionEffect(PotionEffectType.BLINDNESS);
}
示例3: isCritical
public static boolean isCritical(Player player) {
Location location = player.getLocation();
location.setY(player.getLocation().getY() -2);
return player.getFallDistance() > 0.0f && player.getLocation().getY() % 1 != 0 && !player.isInsideVehicle() && !player.hasPotionEffect(PotionEffectType.BLINDNESS) && !Utilities.isHoveringOverWater(location) &&
player
.getEyeLocation()
.getBlock()
.getType
() !=
Material
.LADDER;
}
示例4: isOnLadder
/**
* @return If the player is on a ladder or not.
*/
public final boolean isOnLadder() {
return getBlockPlayerIsIn().getType() == Material.LADDER;
}
示例5: isClimbing
public static boolean isClimbing(Location location) {
Material material = location.getBlock().getType();
return material == Material.LADDER || material == Material.VINE;
}
示例6: isClimbable
public static boolean isClimbable(Material material) {
return material == Material.LADDER || material == Material.VINE;
}
示例7: playerIsOnLadder
private boolean playerIsOnLadder(Player player) {
return player.getLocation().getBlock().getType() == Material.LADDER;
}
示例8: isClimbableBlock
public static boolean isClimbableBlock(Block block) {
return block.getType() == Material.VINE || block.getType() == Material.LADDER || block.getType() == Material.WATER || block.getType() == Material.STATIONARY_WATER;
}