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