本文整理汇总了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();
}
示例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);
}
示例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;
}
示例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));
}
示例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;
}