本文整理汇总了Java中org.spongepowered.api.world.Location.add方法的典型用法代码示例。如果您正苦于以下问题:Java Location.add方法的具体用法?Java Location.add怎么用?Java Location.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.spongepowered.api.world.Location
的用法示例。
在下文中一共展示了Location.add方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findNeighborBlocks
import org.spongepowered.api.world.Location; //导入方法依赖的package包/类
private int findNeighborBlocks(BlockSnapshot snapshot) {
int matchCount = 0;
Location<World> location = snapshot.getLocation().get();
if (OreAlerts.recentLocations.containsKey(location)) {
return matchCount;
}
OreAlerts.recentLocations.put(snapshot.getLocation().get(), new Date().getTime());
for (int x = -1; x <= 1; x++) {
for (int z = -1; z <= 1; z++) {
for (int y = -1; y <= 1; y++) {
Location<World> neighborLocation = location.add(x, y, z);
BlockSnapshot neighbor = neighborLocation.getBlock().snapshotFor(neighborLocation);
if (neighbor.getState().getType().equals(snapshot.getState().getType()) && !OreAlerts.recentLocations.containsKey(neighborLocation)) {
matchCount++;
if (matchCount < 30) {
matchCount += findNeighborBlocks(neighbor);
}
}
}
}
}
return matchCount;
}