Port to 26.1

This commit is contained in:
skippyall
2026-04-29 17:20:13 +02:00
parent f5202a4264
commit e117139a63
100 changed files with 609 additions and 550 deletions
@@ -3,18 +3,18 @@ package io.github.skippyall.minions.polymer;
import eu.pb4.polymer.networking.api.PolymerNetworking;
import eu.pb4.polymer.networking.api.server.PolymerServerNetworking;
import io.github.skippyall.minions.Minions;
import net.fabricmc.fabric.api.networking.v1.context.PacketContext;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.resources.Identifier;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import xyz.nucleoid.packettweaker.PacketContext;
public class VersionSync {
public static final int NETWORK_VERSION = 1;
public static boolean isOnClient(PacketContext context) {
if(context.getPlayer() != null) {
return isOnClient(context.getPlayer().connection);
if(context != null && context.get(PacketContext.CONNECTION).getPacketListener() instanceof ServerGamePacketListenerImpl gamePacketListener) {
return isOnClient(gamePacketListener);
}
return false;
}
@@ -25,7 +25,7 @@ public class VersionSync {
public static class VersionSyncPayload implements CustomPacketPayload {
public static final CustomPacketPayload.Type<VersionSyncPayload> PACKET_ID = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(Minions.MOD_ID, "version_sync"));
public static final CustomPacketPayload.Type<VersionSyncPayload> PACKET_ID = new CustomPacketPayload.Type<>(Identifier.fromNamespaceAndPath(Minions.MOD_ID, "version_sync"));
@Override
public Type<? extends CustomPacketPayload> type() {
@@ -34,6 +34,6 @@ public class VersionSync {
}
public static void register() {
PolymerNetworking.registerS2CVersioned(VersionSyncPayload.PACKET_ID, NETWORK_VERSION, StreamCodec.unit(null));
PolymerNetworking.registerClientboundVersioned(VersionSyncPayload.PACKET_ID, NETWORK_VERSION, StreamCodec.unit(null));
}
}