Search in sources :

Example 31 with ChunkProviderServer

use of net.minecraft.world.gen.ChunkProviderServer in project CatServer by Luohuayu.

the class CraftWorld method processChunkGC.

public void processChunkGC() {
    chunkGCTickCount++;
    if (chunkLoadCount >= server.chunkGCLoadThresh && server.chunkGCLoadThresh > 0) {
        chunkLoadCount = 0;
    } else if (chunkGCTickCount >= server.chunkGCPeriod && server.chunkGCPeriod > 0) {
        chunkGCTickCount = 0;
    } else {
        return;
    }
    ChunkProviderServer cps = world.getChunkProvider();
    for (net.minecraft.world.chunk.Chunk chunk : cps.id2ChunkMap.values()) {
        // If in use, skip it
        if (isChunkInUse(chunk.x, chunk.z)) {
            continue;
        }
        // Already unloading?
        if (cps.droppedChunksSet.contains(ChunkPos.asLong(chunk.x, chunk.z))) {
            // CatServer
            if (!chunk.unloadQueued)
                chunk.unloadQueued = true;
            continue;
        }
        // Add unload request
        cps.queueUnload(chunk);
    }
}
Also used : ChunkProviderServer(net.minecraft.world.gen.ChunkProviderServer)

Example 32 with ChunkProviderServer

use of net.minecraft.world.gen.ChunkProviderServer in project Magma by magmafoundation.

the class CraftWorld method processChunkGC.

public void processChunkGC() {
    chunkGCTickCount++;
    if (chunkLoadCount >= server.chunkGCLoadThresh && server.chunkGCLoadThresh > 0) {
        chunkLoadCount = 0;
    } else if (chunkGCTickCount >= server.chunkGCPeriod && server.chunkGCPeriod > 0) {
        chunkGCTickCount = 0;
    } else {
        return;
    }
    ChunkProviderServer cps = world.getChunkProvider();
    for (net.minecraft.world.chunk.Chunk chunk : cps.id2ChunkMap.values()) {
        // If in use, skip it
        if (isChunkInUse(chunk.x, chunk.z)) {
            continue;
        }
        // Already unloading?
        if (cps.droppedChunksSet.contains(ChunkPos.asLong(chunk.x, chunk.z))) {
            continue;
        }
        // Add unload request
        cps.queueUnload(chunk);
    }
}
Also used : ChunkProviderServer(net.minecraft.world.gen.ChunkProviderServer)

Aggregations

ChunkProviderServer (net.minecraft.world.gen.ChunkProviderServer)32 Chunk (net.minecraft.world.chunk.Chunk)14 WorldServer (net.minecraft.world.WorldServer)13 IChunkProvider (net.minecraft.world.chunk.IChunkProvider)6 TileEntity (net.minecraft.tileentity.TileEntity)4 ArrayList (java.util.ArrayList)3 Block (net.minecraft.block.Block)3 ChunkProviderClient (net.minecraft.client.multiplayer.ChunkProviderClient)3 Entity (net.minecraft.entity.Entity)3 MinecraftServer (net.minecraft.server.MinecraftServer)3 BlockPos (net.minecraft.util.math.BlockPos)3 ChunkCoordIntPair (net.minecraft.world.ChunkCoordIntPair)3 World (net.minecraft.world.World)3 IHasMass (com.builtbroken.mc.api.IHasMass)2 Collection (java.util.Collection)2 ChatComponentText (net.minecraft.util.ChatComponentText)2 ChunkPos (net.minecraft.util.math.ChunkPos)2 IMixinChunkProviderServer (org.spongepowered.common.interfaces.world.gen.IMixinChunkProviderServer)2 EntitySelector (com.builtbroken.mc.prefab.entity.selector.EntitySelector)1 Predicate (com.google.common.base.Predicate)1