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


Java Chunk.onChunkUnload方法代码示例

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


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

示例1: unloadQueuedChunks

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
 */
public boolean unloadQueuedChunks()
{
    if (!this.worldObj.disableLevelSaving)
    {
        for (int i = 0; i < 100; ++i)
        {
            if (!this.droppedChunksSet.isEmpty())
            {
                Long olong = (Long)this.droppedChunksSet.iterator().next();
                Chunk chunk = (Chunk)this.id2ChunkMap.getValueByKey(olong.longValue());

                if (chunk != null)
                {
                    chunk.onChunkUnload();
                    this.saveChunkData(chunk);
                    this.saveChunkExtraData(chunk);
                    this.id2ChunkMap.remove(olong.longValue());
                    this.loadedChunks.remove(chunk);
                }

                this.droppedChunksSet.remove(olong);
            }
        }

        if (this.chunkLoader != null)
        {
            this.chunkLoader.chunkTick();
        }
    }

    return this.serverChunkGenerator.unloadQueuedChunks();
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:36,代码来源:ChunkProviderServer.java

示例2: unloadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set
 * to false
 */
public void unloadChunk(int p_73234_1_, int p_73234_2_)
{
    Chunk chunk = this.provideChunk(p_73234_1_, p_73234_2_);

    if (!chunk.isEmpty())
    {
        chunk.onChunkUnload();
    }

    this.chunkMapping.remove(ChunkCoordIntPair.chunkXZ2Int(p_73234_1_, p_73234_2_));
    this.chunkListing.remove(chunk);
}
 
开发者ID:Notoh,项目名称:DecompiledMinecraft,代码行数:17,代码来源:ChunkProviderClient.java

示例3: unloadQueuedChunks

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
 */
public boolean unloadQueuedChunks()
{
    if (!this.worldObj.disableLevelSaving)
    {
        if (!this.droppedChunksSet.isEmpty())
        {
            Iterator<Long> iterator = this.droppedChunksSet.iterator();

            for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove())
            {
                Long olong = (Long)iterator.next();
                Chunk chunk = (Chunk)this.id2ChunkMap.get(olong);

                if (chunk != null && chunk.unloaded)
                {
                    chunk.onChunkUnload();
                    this.saveChunkData(chunk);
                    this.saveChunkExtraData(chunk);
                    this.id2ChunkMap.remove(olong);
                    ++i;
                }
            }
        }

        this.chunkLoader.chunkTick();
    }

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

示例4: unloadChunk

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unload chunk from ChunkProviderClient's hashmap. Called in response to a Packet50PreChunk with its mode field set
 * to false
 */
public void unloadChunk(int x, int z)
{
    Chunk chunk = this.provideChunk(x, z);

    if (!chunk.isEmpty())
    {
        chunk.onChunkUnload();
    }

    this.chunkMapping.remove(ChunkPos.asLong(x, z));
}
 
开发者ID:sudofox,项目名称:Backmemed,代码行数:16,代码来源:ChunkProviderClient.java

示例5: unloadQueuedChunks

import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
/**
 * Unloads chunks that are marked to be unloaded. This is not guaranteed to unload every such chunk.
 */
public boolean unloadQueuedChunks()
{
    if (!this.worldObj.disableLevelSaving)
    {
        if (!this.droppedChunksSet.isEmpty())
        {
            for (ChunkPos forced : this.worldObj.getPersistentChunks().keySet())
            {
                this.droppedChunksSet.remove(ChunkPos.asLong(forced.chunkXPos, forced.chunkZPos));
            }

            Iterator<Long> iterator = this.droppedChunksSet.iterator();

            for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove())
            {
                Long olong = (Long)iterator.next();
                Chunk chunk = (Chunk)this.id2ChunkMap.get(olong);

                if (chunk != null && chunk.unloaded)
                {
                    chunk.onChunkUnload();
                    this.saveChunkData(chunk);
                    this.saveChunkExtraData(chunk);
                    this.id2ChunkMap.remove(olong);
                    ++i;
                    net.minecraftforge.common.ForgeChunkManager.putDormantChunk(ChunkPos.asLong(chunk.xPosition, chunk.zPosition), chunk);
                    if (id2ChunkMap.size() == 0 && net.minecraftforge.common.ForgeChunkManager.getPersistentChunksFor(this.worldObj).size() == 0 && !this.worldObj.provider.getDimensionType().shouldLoadSpawn()){
                        net.minecraftforge.common.DimensionManager.unloadWorld(this.worldObj.provider.getDimension());
                        break;
                    }
                }
            }
        }

        this.chunkLoader.chunkTick();
    }

    return false;
}
 
开发者ID:F1r3w477,项目名称:CustomWorldGen,代码行数:43,代码来源:ChunkProviderServer.java


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