Uploaded image for project: 'Spigot'
  1. Spigot
  2. SPIGOT-2315

Unloading Chunks keeps NeighborChunks loaded in CraftWorld (Addition to SPIGOT-2303)

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • None
    • None
    • None

      Hey,

      adding to SPIGOT-2303 there is another problem with using cunkproviderserver.getLoadedChunkAt(). The main problem again is the newly introduced boolean in chunk.java to keep chunks from being unloaded.
      It is used in cunkproviderserver.getLoadedChunkAt()

      I wrote a less spiking processChunkGC and this problem came up
      In CraftWorld.java the method
      unloadChunk0(int x, int z, boolean save, boolean safe)
      The setNeighborUnloaded-Code would keep chunks from unloading just because its neighbor got unloaded.

          private boolean unloadChunk0(int x, int z, boolean save, boolean safe) {
              [...]
                      net.minecraft.server.Chunk neighbor = world.getChunkProviderServer().getLoadedChunkAt(chunk.locX + x, chunk.locZ + z); 
                      if (neighbor != null) {
                          neighbor.setNeighborUnloaded(-xx, -zz);
                          chunk.setNeighborUnloaded(xx, zz);
                      }
       [...]
          }
      

      Changing this from getLoadedChunkAt to getChunkIfLoaded should fix the problem

            Unassigned Unassigned
            Kademlia Kademlia
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: