本文整理匯總了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;
}