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


Java ForgeChunkManager.fetchDormantChunk方法代码示例

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


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

示例1: originalLoadChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public Chunk originalLoadChunk(final int chunkX, final int chunkZ) {
	final long key = ChunkCoordIntPair.chunkXZ2Int(chunkX, chunkZ);
	removeFromChunksToUnload(key);
	Chunk chunk = (Chunk) this.loadedChunkHashMap.getValueByKey(key);

	if (chunk == null) {
		boolean added = this.loadingChunks.add(key);
		if (!added) {
			cpw.mods.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.",
					chunkX, chunkZ, worldObj.provider.dimensionId);
		}
		chunk = ForgeChunkManager.fetchDormantChunk(key, this.worldObj);
		if (chunk == null) {
			chunk = this.safeLoadChunk(chunkX, chunkZ);
		}

		if (chunk == null) {
			if (this.currentChunkProvider == null) {
				chunk = this.defaultEmptyChunk;
			} else {
				try {
					chunk = this.currentChunkProvider.provideChunk(chunkX, chunkZ);
				} 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[] { chunkX, chunkZ }));
					crashreportcategory.addCrashSection("Position hash", key);
					crashreportcategory.addCrashSection("Generator", this.currentChunkProvider.makeString());
					throw new ReportedException(crashreport);
				}
			}
		}

		this.loadedChunkHashMap.add(key, chunk);
		addToLoadedChunks(chunk);
		this.loadingChunks.remove(key);
		chunk.onChunkLoad();
		chunk.populateChunk(this, this, chunkX, chunkZ);
	}

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

示例2: originalLoadChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_)
{
    this.chunksToUnload.remove(p_73158_1_, p_73158_2_);
    Chunk chunk = (Chunk) this.loadedChunkHashMap.get(LongHash.toLong(p_73158_1_, p_73158_2_));
    boolean newChunk = false; // CraftBukkit

    if (chunk == null)
    {
        worldObj.timings.syncChunkLoadTimer.startTiming(); // Spigot
        boolean added = loadingChunks.add(LongHash.toLong(p_73158_1_, p_73158_2_));
        if (!added)
        {
            cpw.mods.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.", p_73158_1_, p_73158_2_, worldObj.provider.dimensionId);
        }
        chunk = ForgeChunkManager.fetchDormantChunk(LongHash.toLong(p_73158_1_, p_73158_2_), this.worldObj);
        if (chunk == null)
        {
            chunk = this.safeLoadChunk(p_73158_1_, p_73158_2_);
        }

        if (chunk == null)
        {
            if (this.currentChunkProvider == null)
            {
                chunk = this.defaultEmptyChunk;
            }
            else
            {
                try
                {
                    chunk = this.currentChunkProvider.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", LongHash.toLong(p_73158_1_, p_73158_2_));
                    crashreportcategory.addCrashSection("Generator", this.currentChunkProvider.makeString());
                    throw new ReportedException(crashreport);
                }
            }

            newChunk = true; // CraftBukkit
        }

        this.loadedChunkHashMap.put(LongHash.toLong(p_73158_1_, p_73158_2_), chunk); // CraftBukkit
        this.loadedChunks.add(chunk); // Cauldron - vanilla compatibility
        loadingChunks.remove(LongHash.toLong(p_73158_1_, p_73158_2_)); // Cauldron - LongHash

        if (chunk != null)
        {
            chunk.onChunkLoad();
        }
        // CraftBukkit start
        Server server = this.worldObj.getServer();

        if (server != null)
        {
            /*
             * If it's a new world, the first few chunks are generated inside
             * the World constructor. We can't reliably alter that, so we have
             * no way of creating a CraftWorld/CraftServer at that point.
             */
            server.getPluginManager().callEvent(new org.bukkit.event.world.ChunkLoadEvent(chunk.bukkitChunk, newChunk));
        }

        // CraftBukkit end
        chunk.populateChunk(this, this, p_73158_1_, p_73158_2_);
        worldObj.timings.syncChunkLoadTimer.stopTiming(); // Spigot
    }

    return chunk;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:75,代码来源:ChunkProviderServer.java

示例3: originalLoadChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
public Chunk originalLoadChunk(int p_73158_1_, int p_73158_2_)
{
    long k = ChunkCoordIntPair.chunkXZ2Int(p_73158_1_, p_73158_2_);
    this.chunksToUnload.remove(Long.valueOf(k));
    Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(k);

    if (chunk == null)
    {
        boolean added = loadingChunks.add(k);
        if (!added)
        {
            cpw.mods.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.", p_73158_1_, p_73158_2_, worldObj.provider.dimensionId);
        }
        chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj);
        if (chunk == null)
        {
            chunk = this.safeLoadChunk(p_73158_1_, p_73158_2_);
        }

        if (chunk == null)
        {
            if (this.currentChunkProvider == null)
            {
                chunk = this.defaultEmptyChunk;
            }
            else
            {
                try
                {
                    chunk = this.currentChunkProvider.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(k));
                    crashreportcategory.addCrashSection("Generator", this.currentChunkProvider.makeString());
                    throw new ReportedException(crashreport);
                }
            }
        }

        this.loadedChunkHashMap.add(k, chunk);
        this.loadedChunks.add(chunk);
        loadingChunks.remove(k);
        chunk.onChunkLoad();
        chunk.populateChunk(this, this, p_73158_1_, p_73158_2_);
    }

    return chunk;
}
 
开发者ID:xtrafrancyz,项目名称:Cauldron,代码行数:53,代码来源:ChunkProviderServer.java

示例4: loadChunk

import net.minecraftforge.common.ForgeChunkManager; //导入方法依赖的package包/类
/**
 * loads or generates the chunk at the chunk location specified
 */
public Chunk loadChunk(int par1, int par2)
{
    long k = ChunkCoordIntPair.chunkXZ2Int(par1, par2);
    this.chunksToUnload.remove(Long.valueOf(k));
    Chunk chunk = (Chunk)this.loadedChunkHashMap.getValueByKey(k);

    if (chunk == null)
    {
        chunk = ForgeChunkManager.fetchDormantChunk(k, this.worldObj);
        if (chunk == null)
        {
            chunk = this.safeLoadChunk(par1, par2);
        }

        if (chunk == null)
        {
            if (this.currentChunkProvider == null)
            {
                chunk = this.defaultEmptyChunk;
            }
            else
            {
                try
                {
                    chunk = this.currentChunkProvider.provideChunk(par1, par2);
                }
                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(par1), Integer.valueOf(par2)}));
                    crashreportcategory.addCrashSection("Position hash", Long.valueOf(k));
                    crashreportcategory.addCrashSection("Generator", this.currentChunkProvider.makeString());
                    throw new ReportedException(crashreport);
                }
            }
        }

        this.loadedChunkHashMap.add(k, chunk);
        this.loadedChunks.add(chunk);

        if (chunk != null)
        {
            chunk.onChunkLoad();
        }

        chunk.populateChunk(this, this, par1, par2);
    }

    return chunk;
}
 
开发者ID:HATB0T,项目名称:RuneCraftery,代码行数:55,代码来源:ChunkProviderServer.java


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