Skip to content

Commit d562301

Browse files
committed
[6.0.11][publish] Experimental > fix LevelLightEngine
1 parent 60045bf commit d562301

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

module/module-nms-util/src/main/java/taboolib/module/nms/NMSGenericImpl.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@
4848
import java.util.concurrent.atomic.AtomicInteger;
4949
import java.util.function.Consumer;
5050

51+
import static taboolib.module.nms.MinecraftServerUtilKt.nmsClass;
5152
import static taboolib.module.nms.MinecraftServerUtilKt.sendPacket;
5253

5354
/**
@@ -65,6 +66,7 @@ public class NMSGenericImpl extends NMSGeneric {
6566
private Method getKeyMethod;
6667

6768
public NMSGenericImpl() {
69+
// 1.13+
6870
if (MinecraftVersion.INSTANCE.getMajor() >= 5) {
6971
for (Field declaredField : net.minecraft.server.v1_12_R1.Entity.class.getDeclaredFields()) {
7072
if (declaredField.getType().getSimpleName().equals("EntityTypes")) {
@@ -73,16 +75,19 @@ public NMSGenericImpl() {
7375
}
7476
}
7577
}
78+
// 1.17+
7679
if (MinecraftVersion.INSTANCE.getMajor() >= 9) {
7780
try {
81+
// 1.18+
7882
if (MinecraftVersion.INSTANCE.getMajor() >= 10) {
7983
Class<?> entityTypes = MinecraftServerUtilKt.nmsClass("EntityTypes");
8084
getKeyMethod = ((Class<?>) entityTypes).getDeclaredMethod("a", entityTypes);
8185
}
86+
// 1.20+
8287
if (MinecraftVersion.INSTANCE.getMajor() >= 12) {
8388
packetPlayOutLightUpdateConstructor = net.minecraft.server.v1_16_R1.PacketPlayOutLightUpdate.class.getDeclaredConstructor(
8489
net.minecraft.server.v1_16_R1.ChunkCoordIntPair.class,
85-
net.minecraft.world.level.lighting.LevelLightEngine.class,
90+
nmsClass("LevelLightEngine"), // class file has wrong version 61.0, should be 52.0
8691
BitSet.class,
8792
BitSet.class
8893
);

0 commit comments

Comments
 (0)