Cleaning "ghost lights"

Discussion in 'CommandHelper' started by Oboist, May 20, 2018.

  1. Oboist

    Oboist Member

    You probably know, that there's that old light bug in minecraft that leads to situations like that: [​IMG]
    I believe, it happens then block that emits light is broken/changed in unloaded chunk (so it never happens near spawn).
    I have little auto-cleaner on CH that once a day cleans all block changes made outside regions, so, while being very tidy, my server suffers a lot from that weird lights at night.
    I tried to load needed chunks before cleaning, if block is a light source (something like that:
    PHP:

        @chunk = get_chunk_loc(array(@trgt[0], @trgt[1], @trgt[2], 'world'))
        load_chunk('world', @chunk[x], @chunk[z])
        load_chunk('world', @chunk[x] + 1, @chunk[z])
        load_chunk('world', @chunk[x] - 1, @chunk[z])
        load_chunk('world', @chunk[x], @chunk[z] + 1)
        load_chunk('world', @chunk[x], @chunk[z] - 1)
        set_timeout(100, closure(set_block_at(@trgt[0], @trgt[1], @trgt[2], 0, 'world')))
       
    ), but still no luck. Maybe i'm doing something wrong or misunderstood how chunks are loaded...
    Last edited: May 20, 2018
  2. PseudoKnight

    PseudoKnight Well-Known Member Developer

    Good question. I'd have to test this out myself. The chunk may be unloaded the next tick, though, so a timeout there either needs to be 1 tick or none. But you probably tried that. It could also depend on your server implementation, maybe.
  3. Oboist

    Oboist Member

    Yes, tried... Even added console(get_loaded_chunks('world')) inside closure and manually checked. And @chunk was there!.. But, still, problem with lights remains.
  4. Oboist

    Oboist Member

    So, no luck, i suppose?
    Using Spigot.
    Is it possible to look that events in minecraft cause light recalculation to choose right strategy?
  5. PseudoKnight

    PseudoKnight Well-Known Member Developer

    It's probably this bug: https://bugs.mojang.com/browse/MC-93132

    I tried all sorts of workarounds, but nothing short of a player being nearby fixed it in 1.12.2, or using something like FastAsyncWorldEdit. In 1.13.1 you could try a temporary chunk loader, but I'm not sure how much overhead that would be.
  6. PseudoKnight

    PseudoKnight Well-Known Member Developer

    sk_setblock() relights the area properly if you're using FastAsyncWorldEdit, but not regular WorldEdit. :(