Skip to content

Commit

Permalink
[6.0.11][publish] Experimental > fix LevelLightEngine
Browse files Browse the repository at this point in the history
  • Loading branch information
Bkm016 committed Jun 11, 2023
1 parent 60045bf commit d562301
Showing 1 changed file with 6 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Consumer;

import static taboolib.module.nms.MinecraftServerUtilKt.nmsClass;
import static taboolib.module.nms.MinecraftServerUtilKt.sendPacket;

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

public NMSGenericImpl() {
// 1.13+
if (MinecraftVersion.INSTANCE.getMajor() >= 5) {
for (Field declaredField : net.minecraft.server.v1_12_R1.Entity.class.getDeclaredFields()) {
if (declaredField.getType().getSimpleName().equals("EntityTypes")) {
Expand All @@ -73,16 +75,19 @@ public NMSGenericImpl() {
}
}
}
// 1.17+
if (MinecraftVersion.INSTANCE.getMajor() >= 9) {
try {
// 1.18+
if (MinecraftVersion.INSTANCE.getMajor() >= 10) {
Class<?> entityTypes = MinecraftServerUtilKt.nmsClass("EntityTypes");
getKeyMethod = ((Class<?>) entityTypes).getDeclaredMethod("a", entityTypes);
}
// 1.20+
if (MinecraftVersion.INSTANCE.getMajor() >= 12) {
packetPlayOutLightUpdateConstructor = net.minecraft.server.v1_16_R1.PacketPlayOutLightUpdate.class.getDeclaredConstructor(
net.minecraft.server.v1_16_R1.ChunkCoordIntPair.class,
net.minecraft.world.level.lighting.LevelLightEngine.class,
nmsClass("LevelLightEngine"), // class file has wrong version 61.0, should be 52.0
BitSet.class,
BitSet.class
);
Expand Down

0 comments on commit d562301

Please sign in to comment.