#-

1 messages · Page 1 of 1 (latest)

thorny kite
#

hey hey, trying to figure out client sided blocks at the moment.
I have a very complicated and messy flashlight plugin set up, basically it places light blocks where you look in certain distances ( adjustable and stuff )
basically, i wanted to switch from placing real lightblocks to fake client-side lightblocks to everyone.
This is how i tried:
Instead of

lightblock.setType(Material.LIGHT); // place new lightblock at new location

I used

for(Player lp : Bukkit.getServer().getOnlinePlayers()){
      lp.sendBlockChange(lightblock.getLocation(), Material.LIGHT.createBlockData());
      }

Creation of this lightblock works, but when i want to remove it again using the same method like this it doesn't work:
Instead of

prevsafety.getBlock().setType(Material.AIR); // remove lightblock

I used

for(Player lp : Bukkit.getServer().getOnlinePlayers()){
    lp.sendBlockChange(prevsafety, Material.AIR.createBlockData());
    }```
 
Issue is, it works when just setting it to air in normal blocks, but when i do it client-sided with sendBlockChange it doesn't remove the lightblock
#

to sum it up: sendBlockChange for setting a client sided lightblock works, but when i want to remove it (place air over it) it doesn't work

#

does anyone know why it might not work? I haven't found anything in spigot docs, nor after googling for hours at a time

cosmic tree
#

idk why that wouldn't work, but as a work around you might be able to send blockdata of a light with 0 for its level

thorny kite
cosmic tree
#

you can set the light level of light blocks

#

*extends

thorny kite
#

okay, but i still want it to emmit light

cosmic tree
#

you want it to emit light when removing it?

thorny kite
#

oh, wait

#

no i don't

#

makes sense!

#

yeah, that might give an insane amount of clientside lightblocks

#

since it refreshes them a lot

#

I'll think about how to implement it, thanks

#

if anyone has an idea, feel free to say it to me