本文整理汇总了Java中net.minecraft.world.chunk.Chunk.isLoaded方法的典型用法代码示例。如果您正苦于以下问题:Java Chunk.isLoaded方法的具体用法?Java Chunk.isLoaded怎么用?Java Chunk.isLoaded使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类net.minecraft.world.chunk.Chunk
的用法示例。
在下文中一共展示了Chunk.isLoaded方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onServerTick
import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@SubscribeEvent
public void onServerTick(TickEvent.ServerTickEvent event) {
for (ISemiBlock semiBlock : addingBlocks) {
Chunk chunk = semiBlock.getWorld().getChunkFromBlockCoords(semiBlock.getPos());
addPendingBlock(chunk, semiBlock);
chunk.markDirty();
for (EntityPlayer player : syncList.get(chunk)) {
NetworkHandler.sendTo(new PacketAddSemiBlock(semiBlock), (EntityPlayerMP) player);
PacketDescription descPacket = semiBlock.getDescriptionPacket();
if (descPacket != null) NetworkHandler.sendTo(descPacket, (EntityPlayerMP) player);
}
}
addingBlocks.clear();
for (Chunk removingChunk : chunksMarkedForRemoval) {
if (!removingChunk.isLoaded()) {
semiBlocks.remove(removingChunk);
syncList.remove(removingChunk);
}
}
chunksMarkedForRemoval.clear();
semiBlocks.values().forEach(this::update);
}
示例2: tick
import net.minecraft.world.chunk.Chunk; //导入方法依赖的package包/类
@Override
public boolean tick() {
if (!droppedChunksSet.isEmpty()) {
for (ChunkPos forced : worldObj.getPersistentChunks().keySet()) {
droppedChunksSet.remove(ChunkPos.asLong(forced.x, forced.z));
}
Iterator<Long> iterator = droppedChunksSet.iterator();
for (int i = 0; i < 100 && iterator.hasNext(); iterator.remove()) {
Long olong = iterator.next();
Chunk chunk = id2ChunkMap.get(olong);
if (chunk != null && !chunk.isLoaded()) {
chunk.onUnload();
id2ChunkMap.remove(olong);
++i;
net.minecraftforge.common.ForgeChunkManager
.putDormantChunk(ChunkPos.asLong(chunk.x, chunk.z), chunk);
if (id2ChunkMap.size() == 0 && net.minecraftforge.common.ForgeChunkManager
.getPersistentChunksFor(worldObj).size() == 0
&& !worldObj.provider.getDimensionType().shouldLoadSpawn()) {
net.minecraftforge.common.DimensionManager.unloadWorld(worldObj.provider.getDimension());
break;
}
}
}
}
return false;
}