Merge remote-tracking branch 'jarvabb/1.20-alternative' into 1.20-alternative
This commit is contained in:
@@ -33,8 +33,11 @@ public class PowerLevelPacket {
|
|||||||
public static class Handler {
|
public static class Handler {
|
||||||
public static void handle(PowerLevelPacket message, Supplier<NetworkEvent.Context> ctx) {
|
public static void handle(PowerLevelPacket message, Supplier<NetworkEvent.Context> ctx) {
|
||||||
NetworkEvent.Context context = ctx.get();
|
NetworkEvent.Context context = ctx.get();
|
||||||
context.enqueueWork(() -> {
|
|
||||||
if (context.getDirection().getReceptionSide().isClient()) {
|
if (context.getDirection().getReceptionSide().isClient()) {
|
||||||
|
context.enqueueWork(new Runnable() {
|
||||||
|
// Use anon - lambda causes classloading issues
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
Player player = Minecraft.getInstance().player;
|
Player player = Minecraft.getInstance().player;
|
||||||
if (player != null) {
|
if (player != null) {
|
||||||
player.getCapability(CapabilityHandler.POWER_LEVEL_CAPABILITY, null)
|
player.getCapability(CapabilityHandler.POWER_LEVEL_CAPABILITY, null)
|
||||||
@@ -44,6 +47,7 @@ public class PowerLevelPacket {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
context.setPacketHandled(true);
|
context.setPacketHandled(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user