1.17 NMS Method to run light updates on chunk.

Discussion in 'Plugin Development' started by byteful, Aug 19, 2021.

Thread Status:
Not open for further replies.
  1. Offline

    byteful

    I've been looking through 1.17_R1 NMS and I cannot seem to find the methods needed to run light updates on a specific chunk.

    If anyone knows the method to run updates, please leave it below and how to get the reference to use it.
     
  2. Offline

    byteful

    Bump.
     
  3. Offline

    Tim_M

    try
    Code:
    net.minecraft.server.Chunk c = ((CraftChunk) b.getChunk()).getHandle();
    c.initLighting();
    
    if it doesnt work try this:
    Code:
    ((CraftWorld)w).getHandle().notify(x, y, z);
    
     
  4. Offline

    byteful

    First method doesn't exist in 1.17 & second method sends block updates and also is per block and I need this to update lighting for the whole chunk.
     
  5. Offline

    Tim_M

    Then loop through the blocks and update them.

    I'm pretty sure FAWE allows for chunk updates. Try to check the source code to see how they did it.

    EDIT:
    I just found net.minecraft.world.level.chunk.Chunk.markDirty()
    I think that's supposed to force a re-render but idk. Make a backup before you test it.

    Also have you tried Chunk.load ?
     
    Last edited: Aug 23, 2021
  6. Offline

    byteful

    Tried markDirty() on the chunk and its neighbors and still no difference.
    I've looked through FAWE but it's hard to understand since its heavily abstracted.
     
  7. Offline

    Tim_M

    Did you try bukkit.something.Chunk.load()?
     
  8. Offline

    byteful

    Can't load a chunk that's already loaded. It's also not viable to unload a chunk & reload it since there could be players in there.
     
  9. Offline

    Tim_M

    Last edited: Sep 3, 2021
  10. Offline

    Tim_M

Thread Status:
Not open for further replies.

Share This Page