Recalculate Lighting of one Chunk

Discussion in 'Plugin Development' started by Kierrow, May 3, 2012.

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

    Kierrow

    Hey,

    I found that with a custom world generator I wrote,
    I'm getting a lot of lighting errors, and it started to annoy me and players.

    So I was thinking, "why not just recalculate the chunk's lighting after it generated,
    I mean there is an event for that, right".
    Point is, how DO you recalculate a chunk's/block's lighting?

    Thanks in advance,
    - Kierrow
     
  2. Isn't lightning calculated by the client now?
     
  3. Offline

    CorrieKay

    lighting is indeed calculated by the client.
     
  4. Offline

    Kierrow

    Stupid client then,...

    Anyways, thanks for the info!
     
  5. Offline

    ItsHarry

    Blame Jeb for making such buggy code :p
     
    Kierrow likes this.
  6. I thought it WAS calculated by the client and now it's calculated by the server.

    MCEdit has a option to recalculate lightning on chunks but I dunno about plugins... I belive it's one of those alphabetical methods from CraftBukkit... ( a(), b(), c() etc xD ), I remember someone saying one of them is per block light recalculation and when you use setType() that is also called... so look into the source.
     
  7. Offline

    CorrieKay

    im fairly sure that its possible to do something in the server that causes the light to be recalculated. maybe spawning, then despawning a torch or some other light source?

    not sure though, and it may look weird to the client...
     
  8. Offline

    desht

    This may work (using a NMS call):

    ((CraftChunk)chunk).getHandle().initLighting();
     
Thread Status:
Not open for further replies.

Share This Page