當前位置: 首頁>>代碼示例>>Java>>正文


Java Chunk.getZ方法代碼示例

本文整理匯總了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(); 
		}
 
開發者ID:ThEWiZ76,項目名稱:KingdomFactions,代碼行數:17,代碼來源:ChunkChangeEvent.java

示例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);
            }
        }
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:18,代碼來源:OreRemoverPopulator.java

示例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);
        }
    }

}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:27,代碼來源:OrePopulator.java

示例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);
    }
}
 
開發者ID:SamaGames,項目名稱:SurvivalAPI,代碼行數:19,代碼來源:FortressPopulator.java

示例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();
	}
}
 
開發者ID:kadeska,項目名稱:MT_Core,代碼行數:20,代碼來源:WorldListener.java

示例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.
}
 
開發者ID:DevotedMC,項目名稱:CropControl,代碼行數:15,代碼來源:WorldChunk.java

示例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;
	}
}
 
開發者ID:GelandiAssociation,項目名稱:EscapeLag,代碼行數:14,代碼來源:Utils.java

示例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;
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:17,代碼來源:FactionCache.java

示例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;
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:19,代碼來源:Board.java

示例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);
}
 
開發者ID:DRE2N,項目名稱:FactionsXL,代碼行數:10,代碼來源:WorldCommand.java

示例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;
}
 
開發者ID:Kneesnap,項目名稱:Kineticraft,代碼行數:15,代碼來源:SlimeFinder.java

示例12: ChunkPos

import org.bukkit.Chunk; //導入方法依賴的package包/類
public ChunkPos(Chunk chunk) {
	this(chunk.getWorld().getName(), chunk.getX(), chunk.getZ());
}
 
開發者ID:cjburkey01,項目名稱:ClaimChunk,代碼行數:4,代碼來源:ChunkPos.java

示例13: ChunkWrapper

import org.bukkit.Chunk; //導入方法依賴的package包/類
public ChunkWrapper(Chunk c) {
    this.x = c.getX();
    this.z = c.getZ();
    this.world = c.getWorld().getName();
}
 
開發者ID:edasaki,項目名稱:ZentrelaCore,代碼行數:6,代碼來源:ChunkWrapper.java

示例14: of

import org.bukkit.Chunk; //導入方法依賴的package包/類
public static ChunkPosition of(Chunk chunk) {
    return new ChunkPosition(chunk.getX(), chunk.getZ());
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:ChunkPosition.java

示例15: of

import org.bukkit.Chunk; //導入方法依賴的package包/類
public static ChunkVector of(Chunk chunk) {
    return new ChunkVector(chunk.getX(), chunk.getZ());
}
 
開發者ID:OvercastNetwork,項目名稱:ProjectAres,代碼行數:4,代碼來源:ChunkVector.java


注:本文中的org.bukkit.Chunk.getZ方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。