LightAPI icon indicating copy to clipboard operation
LightAPI copied to clipboard

created lights disapears

Open n0ct opened this issue 4 years ago • 5 comments

Hello,

I'm working on integrating LightAPI in my plugin (lasers-enigma.eu). Overall, it works well. Only one problem remains:

When I modify the lasers trajectories, it happens that some light sources (made using createLight) disappear. However, I don't think I have removed the light source present at this location.

My code can be seen here : Area.java - l.521 to l.543.

  • This part of the code ( from l.521 until l.543) is executed every second.
  • The previouslightLocations contains the locations where the light have been created during the last iteration.
  • The lightLocations contains the locations where the light must appear/stay during this iteration.

Did I do a mistake ? Or is there an issue within LightAPI ? Or should I run createLight again at some point on some locations ? Or maybe should I removeLight synchronously and also update the chunks for deleted lights ?

Thank you for your amazing work.

Best regards,

n0ct avatar Oct 20 '20 10:10 n0ct

  1. What server implementaion (bukkit,spigot,paper,...) and version do you use?
  2. Does the light disappear immediately (1-2 server ticks) after creating or after a few or more seconds?
  3. Could you check light level after it disappeared? location.getBlock().getLightFromBlocks();

May be there is an issue in LightAPI, but first please answer three questions above

Qveshn avatar Oct 23 '20 02:10 Qveshn

I managed to fix it => LasersEnigma 6.8.0: And let there be light

The solution I used:

  • Of course, I don't use the createLight function everywhere all the time, I only use it where new light sources need to be placed and update the corresponding chunks.

  • Of couse, I don't use the deleteLight function everywhere all the time, I only use it where old light sources need to be removed and update the corresponding chunks .

  • But at last, when no change is required during an iteration (no new/removed light locations), I will refresh all the lights sources one last time by recreating each of them and update the corresponding chunks (see here).

So I will only answer your first question: Spigot 1.16.3

The problem was probably related to gradually placing (tick after tick) several light sources next to each other. It was as if the old light sources had disappeared.

You can close the issue if you don't want to investigate further.

n0ct avatar Nov 02 '20 07:11 n0ct

I'm experiencing the same problem, light sources created by LightAPI disappear when creating new light sources with LightAPI

  1. I'm running Paper version 418 (1.16.5)
  2. It's kinda hard to tell since the lights are overlapping eachother
  3. Light levels seem to stay the same

xaanndeer avatar Mar 14 '21 21:03 xaanndeer

@xaanndeer I suppose they will need the same informations they asked me in order to solve your issue. you may also have to give them a link to your code in order to let them check your way to interact with their API.

Meanwhile you can probably use the same workaround I used : When it is required, in a specific area, recreate all light sources.

n0ct avatar Mar 15 '21 13:03 n0ct

@n0ct My bad, I've provided the needed information in my previous reply.

xaanndeer avatar Mar 21 '21 11:03 xaanndeer