ProtocolLib

3M Downloads

About Light Update

inrhor opened this issue ยท 1 comments

commented

Make sure you're doing the following

  • [ y ] You're using the latest build for your server version
  • [ y ] This isn't an issue caused by another plugin
  • [ y ] You've checked for duplicate issues
  • [ y ] You didn't use /reload

Describe the question
https://wiki.vg/Protocol#Update_Light
So far, I don't understand how to use block lighting.
I hope there is an example

API method(s) used
List what API method(s) you're using

Code

val packet = PacketContainer(PacketType.Play.Server.LIGHT_UPDATE)
        packet.modifier.writeDefaults()
        packet.chunkCoordIntPairs.writeSafely(0, ChunkCoordIntPair(location.x.toInt(), location.z.toInt()))
        packet.booleans.writeSafely(0, true)
        packet.integers
            .writeSafely(0, 3)
            .writeSafely(1, 5)
            .writeSafely(5, 5)

error

[14:44:06 ERROR]: Task #3370 for Minecraft v1.0 generated an exception
java.lang.NullPointerException: Cannot invoke "java.lang.Runnable.run()" because "this.cleaner1" is null
        at net.minecraft.server.v1_16_R3.PacketPlayOutLightUpdate.lambda$onPacketDispatchFinish$0(PacketPlayOutLightUpdate.java:38) ~[patched_1.16.5.jar:git-Paper-428]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftTask.run(CraftTask.java:99) ~[patched_1.16.5.jar:git-Paper-428]
        at org.bukkit.craftbukkit.v1_16_R3.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:468) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.b(MinecraftServer.java:1293) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.DedicatedServer.b(DedicatedServer.java:377) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.a(MinecraftServer.java:1208) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.w(MinecraftServer.java:996) ~[patched_1.16.5.jar:git-Paper-428]
        at net.minecraft.server.v1_16_R3.MinecraftServer.lambda$a$0(MinecraftServer.java:173) ~[patched_1.16.5.jar:git-Paper-428]
        at java.lang.Thread.run(Thread.java:832) [?:?]
commented

Looks like paper adds a field called cleaner1 (also cleaner2) to the light packet: https://github.com/PaperMC/Paper/blob/1b383d7e9b423879564c41c6970fa3e4bf845bbb/patches/server/0478-Optimize-NibbleArray-to-use-pooled-buffers.patch#L72

You'll need to get that somehow