stdNullPtr / TorchLight-SpigotMC

TorchLight is a Minecraft plugin that illuminates your offhand torch, enhancing exploration with dynamic lighting. It automatically brightens your surroundings when wielding a torch, providing an immersive experience in dark environments. Enjoy simple commands to toggle the feature.
https://www.spigotmc.org/resources/torch-light.116707/
GNU General Public License v3.0
1 stars 0 forks source link

Redesign lighting logic #8

Open stdNullPtr opened 3 months ago

stdNullPtr commented 3 months ago

Currently, for every AIR block that needs to be lit, a new BukkitRunnable is scheduled to revert it. This can introduce a significant overhead when player count arises.

Maybe we can insert all lit blocks into a queue and have a scheduler pop the last element? But each player must have a personal scheduler. This idea will be scrapped entirely in favor of lighting using packets.

Update: It turns out a lot of issues arise with the initial approach of swapping air blocks to light blocks. The lighting logic must be redesigned to use packets and properly lit a location, instead of replacing blocks with LIGHT material.