当前位置: 首页>>代码示例>>Java>>正文


Java Chunk.populateChunk方法代码示例

本文整理汇总了Java中net.minecraft.world.chunk.Chunk.populateChunk方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.populateChunk方法的具体用法?Java Chunk.populateChunk怎么用?Java Chunk.populateChunk使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在net.minecraft.world.chunk.Chunk的用法示例。


在下文中一共展示了Chunk.populateChunk方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: loadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@Nullable
public Chunk loadChunk(int x, int z)
{
    Chunk chunk = this.getLoadedChunk(x, z);

    if (chunk == null)
    {
        chunk = this.loadChunkFromFile(x, z);

        if (chunk != null)
        {
            this.id2ChunkMap.put(ChunkPos.asLong(x, z), chunk);
            chunk.onChunkLoad();
            chunk.populateChunk(this, this.chunkGenerator);
        }
    }

    return chunk;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:20,代码来源:ChunkProviderServer.java

示例2: provideChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
public Chunk provideChunk(int x, int z)
{
    Chunk chunk = this.loadChunk(x, z);

    if (chunk == null)
    {
        long i = ChunkPos.asLong(x, z);

        try
        {
            chunk = this.chunkGenerator.provideChunk(x, z);
        }
        catch (Throwable throwable)
        {
            CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk");
            CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated");
            crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(x), Integer.valueOf(z)}));
            crashreportcategory.addCrashSection("Position hash", Long.valueOf(i));
            crashreportcategory.addCrashSection("Generator", this.chunkGenerator);
            throw new ReportedException(crashreport);
        }

        this.id2ChunkMap.put(i, chunk);
        chunk.onChunkLoad();
        chunk.populateChunk(this, this.chunkGenerator);
    }

    return chunk;
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:30,代码来源:ChunkProviderServer.java

示例3: loadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@Nullable
public Chunk loadChunk(int x, int z, Runnable runnable)
{
    Chunk chunk = this.getLoadedChunk(x, z);
    if (chunk == null)
    {
        long pos = ChunkPos.asLong(x, z);
        chunk = net.minecraftforge.common.ForgeChunkManager.fetchDormantChunk(pos, this.worldObj);
        if (chunk != null || !(this.chunkLoader instanceof net.minecraft.world.chunk.storage.AnvilChunkLoader))
        {
            if (!loadingChunks.add(pos)) net.minecraftforge.fml.common.FMLLog.bigWarning("There is an attempt to load a chunk (%d,%d) in dimension %d that is already being loaded. This will cause weird chunk breakages.", x, z, this.worldObj.provider.getDimension());
            if (chunk == null) chunk = this.loadChunkFromFile(x, z);

            if (chunk != null)
            {
            this.id2ChunkMap.put(ChunkPos.asLong(x, z), chunk);
            chunk.onChunkLoad();
            chunk.populateChunk(this, this.chunkGenerator);
            }

            loadingChunks.remove(pos);
        }
        else
        {
            net.minecraft.world.chunk.storage.AnvilChunkLoader loader = (net.minecraft.world.chunk.storage.AnvilChunkLoader) this.chunkLoader;
            if (runnable == null)
                chunk = net.minecraftforge.common.chunkio.ChunkIOExecutor.syncChunkLoad(this.worldObj, loader, this, x, z);
            else if (loader.chunkExists(this.worldObj, x, z))
            {
                // We can only use the async queue for already generated chunks
                net.minecraftforge.common.chunkio.ChunkIOExecutor.queueChunkLoad(this.worldObj, loader, this, x, z, runnable);
                return null;
            }
        }
    }

    // If we didn't load the chunk async and have a callback run it now
    if (runnable != null) runnable.run();
    return chunk;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:41,代码来源:ChunkProviderServer.java

示例4: loadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * loads or generates the chunk at the chunk location specified
 */
public Chunk loadChunk(int p_73158_1_, int p_73158_2_)
{
    long i = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_);
    this.droppedChunksSet.remove(Long.valueOf(i));
    Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(i);

    if (chunk == null)
    {
        chunk = this.loadChunkFromFile(p_73158_1_, p_73158_2_);

        if (chunk == null)
        {
            if (this.serverChunkGenerator == null)
            {
                chunk = this.dummyChunk;
            }
            else
            {
                try
                {
                    chunk = this.serverChunkGenerator.provideChunk(p_73158_1_, p_73158_2_);
                }
                catch (Throwable throwable)
                {
                    CrashReport crashreport = CrashReport.makeCrashReport(throwable, "Exception generating new chunk");
                    CrashReportCategory crashreportcategory = crashreport.makeCategory("Chunk to be generated");
                    crashreportcategory.addCrashSection("Location", String.format("%d,%d", new Object[] {Integer.valueOf(p_73158_1_), Integer.valueOf(p_73158_2_)}));
                    crashreportcategory.addCrashSection("Position hash", Long.valueOf(i));
                    crashreportcategory.addCrashSection("Generator", this.serverChunkGenerator.makeString());
                    throw new ReportedException(crashreport);
                }
            }
        }

        this.id2ChunkMap.add(i, chunk);
        this.loadedChunks.add(chunk);
        chunk.onChunkLoad();
        chunk.populateChunk(this, this, p_73158_1_, p_73158_2_);
    }

    return chunk;
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:46,代码来源:ChunkProviderServer.java


注:本文中的net.minecraft.world.chunk.Chunk.populateChunk方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。