Mojang Mappings

This commit is contained in:
skippyall
2026-04-29 08:51:37 +02:00
parent cc9fedd63b
commit f5202a4264
140 changed files with 1646 additions and 1675 deletions
@@ -3,10 +3,10 @@ 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.minecraft.network.codec.PacketCodec;
import net.minecraft.network.packet.CustomPayload;
import net.minecraft.server.network.ServerPlayNetworkHandler;
import net.minecraft.util.Identifier;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.network.ServerGamePacketListenerImpl;
import xyz.nucleoid.packettweaker.PacketContext;
public class VersionSync {
@@ -14,26 +14,26 @@ public class VersionSync {
public static boolean isOnClient(PacketContext context) {
if(context.getPlayer() != null) {
return isOnClient(context.getPlayer().networkHandler);
return isOnClient(context.getPlayer().connection);
}
return false;
}
public static boolean isOnClient(ServerPlayNetworkHandler player) {
public static boolean isOnClient(ServerGamePacketListenerImpl player) {
return PolymerServerNetworking.getSupportedVersion(player, VersionSyncPayload.PACKET_ID.id()) == NETWORK_VERSION;
}
public static class VersionSyncPayload implements CustomPayload {
public static class VersionSyncPayload implements CustomPacketPayload {
public static final CustomPayload.Id<VersionSyncPayload> PACKET_ID = new CustomPayload.Id<>(Identifier.of(Minions.MOD_ID, "version_sync"));
public static final CustomPacketPayload.Type<VersionSyncPayload> PACKET_ID = new CustomPacketPayload.Type<>(ResourceLocation.fromNamespaceAndPath(Minions.MOD_ID, "version_sync"));
@Override
public Id<? extends CustomPayload> getId() {
public Type<? extends CustomPacketPayload> type() {
return PACKET_ID;
}
}
public static void register() {
PolymerNetworking.registerS2CVersioned(VersionSyncPayload.PACKET_ID, NETWORK_VERSION, PacketCodec.unit(null));
PolymerNetworking.registerS2CVersioned(VersionSyncPayload.PACKET_ID, NETWORK_VERSION, StreamCodec.unit(null));
}
}