本文整理汇总了Java中org.bukkit.Chunk.getZ方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.getZ方法的具体用法?Java Chunk.getZ怎么用?Java Chunk.getZ使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.bukkit.Chunk
的用法示例。
在下文中一共展示了Chunk.getZ方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onChunkChange
import org.bukkit.Chunk; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
@EventHandler
public void onChunkChange(PlayerMoveEvent event) {
Location to = event.getTo();
Location from = event.getFrom();
if (to.getBlockX() == from.getBlockX() && to.getBlockZ() == from.getBlockZ()) {
return;
}
Chunk toChunk = to.getChunk();
Chunk fromChunk = from.getChunk();
if (toChunk.getX() == fromChunk.getX() && toChunk.getZ() == fromChunk.getZ()) {
return;
}
PlayerModule.getInstance().getPlayer(event.getPlayer()).handleViewDistance();
}
示例2: populate
import org.bukkit.Chunk; //导入方法依赖的package包/类
@Override
public void populate(World world, Random random, Chunk chunk)
{
for (int x = chunk.getX(); x < chunk.getX() + 16; x++)
{
for (int z = chunk.getZ(); z < chunk.getZ() + 16; z++)
{
for (int y = 0; y < 250; y++)
{
Block block = chunk.getBlock(x, y, z);
if (this.toRemove.contains(block.getType()))
block.setType(Material.STONE);
}
}
}
}
示例3: populate
import org.bukkit.Chunk; //导入方法依赖的package包/类
@Override
public void populate(World world, Random random, Chunk chunk)
{
if (chunk == null)
return;
CraftWorld handle = (CraftWorld) world;
int xr = this.randInt(random, -200, 200);
if (xr >= 50)
new WorldGenCaves().a(handle.getHandle().chunkProviderServer, handle.getHandle(), chunk.getX(), chunk.getZ(), new ChunkSnapshot());
else if (xr <= -50)
new WorldGenCanyon().a(handle.getHandle().chunkProviderServer, handle.getHandle(), chunk.getX(), chunk.getZ(), new ChunkSnapshot());
for (Rule bloc : this.rules)
{
for (int i = 0; i < bloc.round; i++)
{
int x = chunk.getX() * 16 + random.nextInt(16);
int y = bloc.minY + random.nextInt(bloc.maxY - bloc.minY);
int z = chunk.getZ() * 16 + random.nextInt(16);
this.generate(world, random, x, y, z, bloc.size, bloc);
}
}
}
示例4: populate
import org.bukkit.Chunk; //导入方法依赖的package包/类
@Override
public void populate(World world, Random random, Chunk chunk)
{
if (this.bukkitWorld == null)
{
this.bukkitWorld = new BukkitWorld(world);
this.es = WorldEdit.getInstance().getEditSessionFactory().getEditSession(this.bukkitWorld, -1);
this.es.setFastMode(false);
}
if (MathHelper.nextInt(random, 0, 100) == 0)
{
int xFortress = chunk.getX() * 16 + random.nextInt(15);
int zFortress = chunk.getZ() * 16 + random.nextInt(15);
this.generateBlazeFortress(world, xFortress, zFortress);
}
}
示例5: onChunkLoad
import org.bukkit.Chunk; //导入方法依赖的package包/类
@EventHandler
public void onChunkLoad(ChunkLoadEvent e) {
if (!e.isNewChunk())
return;
Chunk chunk = e.getChunk();
int x = chunk.getX() * 16;
int z = chunk.getZ() * 16;
int y = chunk.getWorld().getHighestBlockYAt(x + 8, z + 2);
Location loc = new Location(e.getWorld(), x + 8, y, z + 2);
Random r = new Random();
// 0.2% chance of spawning shelter on generating new chunks
if (r.nextInt(1000) < 2) {
FalloutShelter s = new FalloutShelter(loc.clone());
s.generateFalloutShelter();
}
}
示例6: unloadChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
public static void unloadChunk(Chunk chunk) {
long chunk_id = ((long) chunk.getX() << 32L) + (long) chunk.getZ();
UUID world_uuid = chunk.getWorld().getUID();
//CropControl.getPlugin().debug("Registering unload for chunk {0}:{1}", world_uuid, chunk_id);
Map<Long, WorldChunk> chunks = chunkCacheLoc.get(world_uuid);
if (chunks == null) {
return;
}
WorldChunk cacheChunk = chunks.get(chunk_id);
if (cacheChunk != null) {
unloadQueue.offer(cacheChunk);
}
// note we do not actually remove it here.
}
示例7: isSameChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
public static boolean isSameChunk(Chunk chunk1, Chunk chunk2) {
String c1w = chunk1.getWorld().getName();
String c2w = chunk2.getWorld().getName();
int c1x = chunk1.getX();
int c2x = chunk2.getX();
int c1z = chunk1.getZ();
int c2z = chunk2.getZ();
if (c1w.equals(c2w) && c1x == c2x && c1z == c2z) {
return true;
} else {
return false;
}
}
示例8: getByChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
/**
* @param chunk
* the chunk to check
* @return
* the faction that owns this chunk
*/
public Faction getByChunk(Chunk chunk) {
for (Faction faction : factions) {
for (LazyChunk fChunk : faction.getChunks()) {
if (chunk.getX() == fChunk.getX() && chunk.getZ() == fChunk.getX()) {
return faction;
}
}
}
return null;
}
示例9: getByChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
/**
* @param chunk
* the chunk to check
* @return
* the region that contains the chunk
*/
public Region getByChunk(Chunk chunk) {
for (Region region : regions) {
if (region.getWorld().equals(chunk.getWorld())) {
for (LazyChunk rChunk : region.getChunks()) {
if (rChunk.getX() == chunk.getX() && rChunk.getZ() == chunk.getZ()) {
return region;
}
}
}
}
return null;
}
示例10: removeChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
private void removeChunk(Region region, Chunk chunk) {
LazyChunk remove = null;
for (LazyChunk rChunk : region.getChunks()) {
if (chunk.getX() == rChunk.getX() && chunk.getZ() == rChunk.getZ()) {
remove = rChunk;
}
}
region.getChunks().remove(remove);
}
示例11: isSlimeChunk
import org.bukkit.Chunk; //导入方法依赖的package包/类
/**
* Is the supplied chunk a slime chunk? Since there is no bukkit API for this, we have to use the formula ourselves.
* @param chunk
* @return Is the specified chunk a slime chunk?
*/
private static boolean isSlimeChunk(Chunk chunk) {
int x = chunk.getX();
int z = chunk.getZ();
return new Random(chunk.getWorld().getSeed() +
x * x * 4987142 +
x * 5947611 +
z * z * 4392871L +
z * 389711 ^ 0x3AD8025F).nextInt(10) == 0;
}
示例12: ChunkPos
import org.bukkit.Chunk; //导入方法依赖的package包/类
public ChunkPos(Chunk chunk) {
this(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
}
示例13: ChunkWrapper
import org.bukkit.Chunk; //导入方法依赖的package包/类
public ChunkWrapper(Chunk c) {
this.x = c.getX();
this.z = c.getZ();
this.world = c.getWorld().getName();
}
示例14: of
import org.bukkit.Chunk; //导入方法依赖的package包/类
public static ChunkPosition of(Chunk chunk) {
return new ChunkPosition(chunk.getX(), chunk.getZ());
}
示例15: of
import org.bukkit.Chunk; //导入方法依赖的package包/类
public static ChunkVector of(Chunk chunk) {
return new ChunkVector(chunk.getX(), chunk.getZ());
}