Detecting if player is in range of torch decreasing/increasing visibility

Discussion in 'Plugin Development' started by RipRoss, Dec 9, 2017.

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

    RipRoss

    So what's happening, is everything is much darker than it would usually be at night, and the way you get to see more is to be by torches - making you put more torches down.

    My guess would be to get all blocks in range of the player and then loop through them, check if a torch is in range and increase the visibility.

    What is the best way of doing this? I know that if I looped through all the blocks everytime every player moved, then we would experience lag.

    Could I maybe just decrease the darkness on the server, and then increase the torches effect?

    I'm not new to java, but i am new to bukkit development and so the api is a little strange to me
     
  2. Online

    timtower Administrator Administrator Moderator

    @RipRoss Blocks have a getLightLevel method, checks for any light source or daylight.
     
  3. Offline

    RipRoss

    How would I use this method to implement such a system? So it's pitch black and then within range of that item, it lights an area up? Would i just use this method to change the light level of an item to what I need it and make everything in the world pitch black?

    Does that make sense?
     
  4. Online

    timtower Administrator Administrator Moderator

    @RipRoss You can't set light levels though.
     
  5. Offline

    RipRoss

    Okay, so how would I do what I'm trying to do??
     
  6. Online

    timtower Administrator Administrator Moderator

    Could give a darkness potion effect
     
  7. Offline

    Side8StarLite

    @RipRoss
    This isn't exactly what you want but this post seems like a good idea
     
  8. Offline

    RipRoss

    I mean it's not EXACTLY what I want, but I can definitely take that and manipulate it to do what I need.

    Thanks all
     
Thread Status:
Not open for further replies.

Share This Page