本文整理汇总了Java中org.bukkit.Material.isOccluding方法的典型用法代码示例。如果您正苦于以下问题:Java Material.isOccluding方法的具体用法?Java Material.isOccluding怎么用?Java Material.isOccluding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Material
的用法示例。
在下文中一共展示了Material.isOccluding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isBlockAtLocationOccluding
import org.bukkit.Material; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private static boolean isBlockAtLocationOccluding(Location loc) {
try {
ChunkSnapshot snapshot = null;
int chunkX = (int) Math.floor(loc.getBlockX() / 16d);
int chunkZ = (int) Math.floor(loc.getBlockZ() / 16d);
ChunkCoords cc = new ChunkCoords(loc.getWorld().getName(), chunkX, chunkZ);
if (TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.containsKey(cc)) {
snapshot = TransportPipes.instance.blockChangeListener.cachedChunkSnapshots.get(cc);
}
if (snapshot == null) {
return false;
}
int relativeX = loc.getBlockX() % 16;
if (relativeX < 0) {
relativeX = 16 + relativeX;
}
int relativeZ = loc.getBlockZ() % 16;
if (relativeZ < 0) {
relativeZ = 16 + relativeZ;
}
Material material = Material.getMaterial(snapshot.getBlockTypeId(relativeX, loc.getBlockY(), relativeZ));
return material.isOccluding();
} catch (Exception e) {
e.printStackTrace();
Sentry.capture(e);
return false;
}
}
示例2: isSolid
import org.bukkit.Material; //导入方法依赖的package包/类
/**
* Returns whether or not the given material has a collision box.
* @param mat
* @return solid
*/
public static boolean isSolid(Material mat) {
return mat.isSolid() && mat.isOccluding();
}