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.