From c4cb8080d9decfdc450dfc0b8b063f83f487ab12 Mon Sep 17 00:00:00 2001 From: Lixfel Date: Wed, 1 Mar 2023 22:52:50 +0100 Subject: [PATCH] Fix 1.19.3 SendChunk --- SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java b/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java index e3d4ea7..1627791 100644 --- a/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java +++ b/SpigotCore_18/src/de/steamwar/core/CraftbukkitWrapper18.java @@ -22,16 +22,19 @@ package de.steamwar.core; import com.comphenix.tinyprotocol.Reflection; import com.comphenix.tinyprotocol.TinyProtocol; import net.minecraft.network.protocol.game.ClientboundLevelChunkWithLightPacket; +import net.minecraft.world.level.World; import net.minecraft.world.level.chunk.Chunk; +import net.minecraft.world.level.lighting.LightEngine; import org.bukkit.entity.Player; public class CraftbukkitWrapper18 implements CraftbukkitWrapper.ICraftbukkitWrapper { private static final Reflection.MethodInvoker getHandle = Reflection.getMethod("{obc}.CraftChunk", "getHandle"); + private static final Reflection.MethodInvoker getLightEngine = Reflection.getTypedMethod(World.class, null, LightEngine.class); @Override public void sendChunk(Player p, int chunkX, int chunkZ) { Chunk chunk = (Chunk) getHandle.invoke(p.getWorld().getChunkAt(chunkX, chunkZ)); - TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, chunk.q.l_(), null, null, false)); + TinyProtocol.instance.sendPacket(p, new ClientboundLevelChunkWithLightPacket(chunk, (LightEngine) getLightEngine.invoke(chunk.q), null, null, false, true)); } }