fix: wrap runnable to fix class loading issues

This commit is contained in:
Jarva
2024-01-16 11:20:39 +00:00
parent e16b4e8489
commit 1c0220548c

View File

@@ -33,8 +33,11 @@ public class PowerLevelPacket {
public static class Handler {
public static void handle(PowerLevelPacket message, Supplier<NetworkEvent.Context> ctx) {
NetworkEvent.Context context = ctx.get();
context.enqueueWork(() -> {
if (context.getDirection().getReceptionSide().isClient()) {
context.enqueueWork(new Runnable() {
// Use anon - lambda causes classloading issues
@Override
public void run() {
Player player = Minecraft.getInstance().player;
if (player != null) {
player.getCapability(CapabilityHandler.POWER_LEVEL_CAPABILITY, null)
@@ -44,6 +47,7 @@ public class PowerLevelPacket {
}
}
});
}
context.setPacketHandled(true);
}
}