本文整理汇总了Java中org.bukkit.World.getMaxHeight方法的典型用法代码示例。如果您正苦于以下问题:Java World.getMaxHeight方法的具体用法?Java World.getMaxHeight怎么用?Java World.getMaxHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.World
的用法示例。
在下文中一共展示了World.getMaxHeight方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getHighestLocation
import org.bukkit.World; //导入方法依赖的package包/类
public static Location getHighestLocation(final Location origin, final Location def) {
Preconditions.checkNotNull((Object) origin, (Object) "The location cannot be null");
final Location cloned = origin.clone();
final World world = cloned.getWorld();
final int x = cloned.getBlockX();
int y = world.getMaxHeight();
final int z = cloned.getBlockZ();
while (y > origin.getBlockY()) {
final Block block = world.getBlockAt(x, --y, z);
if (!block.isEmpty()) {
final Location next = block.getLocation();
next.setPitch(origin.getPitch());
next.setYaw(origin.getYaw());
return next;
}
}
return def;
}
示例2: EndPortalFaction
import org.bukkit.World; //导入方法依赖的package包/类
public EndPortalFaction() {
super("EndPortal");
World overworld = Bukkit.getWorld("world");
int maxHeight = overworld.getMaxHeight();
int min = SettingsYML.END_PORTAL_CENTER - SettingsYML.END_PORTAL_RADIUS;
int max = SettingsYML.END_PORTAL_CENTER + SettingsYML.END_PORTAL_RADIUS;
// North East (++)
addClaim(new Claim(this, new Location(overworld, min, 0, min), new Location(overworld, max, maxHeight, max)), null);
// South West (--)
addClaim(new Claim(this, new Location(overworld, -max, maxHeight, -max), new Location(overworld, -min, 0, -min)), null);
// North West (-+)
addClaim(new Claim(this, new Location(overworld, -max, 0, min), new Location(overworld, -min, maxHeight, max)), null);
// South East (+-)
addClaim(new Claim(this, new Location(overworld, min, 0, -max), new Location(overworld, max, maxHeight, -min)), null);
this.safezone = true;
}
示例3: getTopLocation
import org.bukkit.World; //导入方法依赖的package包/类
public static Location getTopLocation(Location location) {
World world = location.getWorld();
int height = world.getMaxHeight();
int x = location.getBlockX();
int z = location.getBlockZ();
for (int i = height; i >= 0; i--) {
Block block = world.getBlockAt(x, i, z);
if (block.getType().isSolid())
return new Location(world, x, i + 1, z);
}
return location;
}
示例4: getEmptyLocation
import org.bukkit.World; //导入方法依赖的package包/类
public static Location getEmptyLocation(Location location, Predicate<Block> filter) {
World world = location.getWorld();
int maxHeight = world.getMaxHeight();
int x = location.getBlockX();
int z = location.getBlockZ();
for (int i = location.getBlockY(); i < maxHeight; i++) {
Block block = world.getBlockAt(x, i, z);
if (block.getType() == Material.AIR
&& filter.test(block))
return new Location(world, x, i, z);
}
return location;
}
示例5: areAjacentBlocksTransparent
import org.bukkit.World; //导入方法依赖的package包/类
public static boolean areAjacentBlocksTransparent(
ChunkMapManager manager,
World world,
boolean checkCurrentBlock,
int x,
int y,
int z,
int countdown
) throws IOException
{
if (y >= world.getMaxHeight() || y < 0)
return true;
if(checkCurrentBlock) {
ChunkData chunkData = manager.getChunkData();
int blockData = manager.get(x, y, z);
int id;
if (blockData < 0) {
id = Orebfuscator.nms.getBlockId(world, x, y, z);
if (id < 0) {
id = 1;
chunkData.useCache = false;
}
} else {
id = ChunkMapManager.getBlockIdFromData(blockData);
}
if (OrebfuscatorConfig.isBlockTransparent(id)) {
return true;
}
}
if (countdown == 0)
return false;
if (areAjacentBlocksTransparent(manager, world, true, x, y + 1, z, countdown - 1))
return true;
if (areAjacentBlocksTransparent(manager, world, true, x, y - 1, z, countdown - 1))
return true;
if (areAjacentBlocksTransparent(manager, world, true, x + 1, y, z, countdown - 1))
return true;
if (areAjacentBlocksTransparent(manager, world, true, x - 1, y, z, countdown - 1))
return true;
if (areAjacentBlocksTransparent(manager, world, true, x, y, z + 1, countdown - 1))
return true;
if (areAjacentBlocksTransparent(manager, world, true, x, y, z - 1, countdown - 1))
return true;
return false;
}
示例6: generateBlockSections
import org.bukkit.World; //导入方法依赖的package包/类
@Nonnull
@Override
public byte[][] generateBlockSections(@Nonnull World world, @Nonnull Random random, int x, int z, @Nonnull BiomeGrid biomes) {
return new byte[world.getMaxHeight() / 16][];
}
示例7: generateExtBlockSections
import org.bukkit.World; //导入方法依赖的package包/类
@Nonnull
@Override
public short[][] generateExtBlockSections(@Nonnull World world, @Nonnull Random random, int x, int z, @Nonnull BiomeGrid biomes) {
return new short[world.getMaxHeight() / 16][];
}
示例8: generateBlockSections
import org.bukkit.World; //导入方法依赖的package包/类
@Override
public byte[][] generateBlockSections(World world, Random rand, int chunkX, int chunkZ, BiomeGrid grid) {
byte[][] chunk = new byte[world.getMaxHeight() / 16][];
basicTerrainGenerator.generate(chunk, world, chunkX, chunkZ, grid);
return chunk;
}