Shaheer Hassan

IN this project make it for 26.2 version

Kodari AI
KodariMon at 11:46 am 1

This project targets Fabric 26.3, but Kodari supports Fabric 26.2. Switch to a 26.2 project to make that version: Switch to Fabric 26.2

Shaheer Hassan

is this ready for 26.2 ?

Kodari AI
KodariMon at 11:49 am 1

Not yet—the project still targets 26.3. I’ll align the build and mod metadata with Fabric 26.2.

  1. Set the Minecraft, loader, and Fabric API versions to the 26.2 releases.

  2. Update the mod’s declared Minecraft and loader requirements to match.

It wasn’t ready: it targeted 26.3. I’ve updated the build and mod metadata to Fabric 26.2. The project is now configured for 26.2; compilation is still needed to confirm the code is compatible.

Shaheer Hassan

make it ready to use than allow me to downaod and name it to Hawk 26.2

Kodari AI
KodariMon at 11:55 am 1
  1. Confirm every Fabric and Minecraft API/mixin signature against the 26.2 sources.

  2. Rename the displayed mod and project to Hawk 26.2 while preserving the hawkbadge resource ID.

  3. Fix any compatibility issues found and leave it ready for Kodari compilation/download.

The project is configured for Minecraft 26.2 and named Hawk 26.2. I also corrected a packet codec lambda to match the 26.2 API.

To build and download the jar:

  1. Click Compile in the top bar (on phone: ⋮ → Compile Project).

  2. Click Compile in the window.

  3. When it succeeds, click Download. If it fails, use Auto-fix in the chat or Fix in the build window.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
11 261
src/main/java/com/hawkbadge/HawkBadge.java
package com.hawkbadge;

import java.util.HashSet;
import java.util.Set;
import java.util.UUID;

import net.fabricmc.api.ModInitializer;
import net.fabricmc.fabric.api.networking.v1.PayloadTypeRegistry;
import net.fabricmc.fabric.api.networking.v1.ServerPlayConnectionEvents;
import net.fabricmc.fabric.api.networking.v1.ServerPlayNetworking;
import net.minecraft.network.RegistryFriendlyByteBuf;
import net.minecraft.network.codec.StreamCodec;
import net.minecraft.network.protocol.common.custom.CustomPacketPayload;
import net.minecraft.server.MinecraftServer;

public class HawkBadge implements ModInitializer {
    private static final Set<UUID> USERS = new HashSet<>();

    public record Hello() implements CustomPacketPayload {
        public static final Type<Hello> TYPE = CustomPacketPayload.createType("hawkbadge:hello");
        public static final StreamCodec<RegistryFriendlyByteBuf, Hello> CODEC =
                CustomPacketPayload.codec((payload, buf) -> {}, buf -> new Hello());

        @Override
        public Type<Hello> type() {
            return TYPE;
        }
    }

    public record Users(Set<UUID> ids) implements CustomPacketPayload {
        public static final Type<Users> TYPE = CustomPacketPayload.createType("hawkbadge:users");
        public static final StreamCodec<RegistryFriendlyByteBuf, Users> CODEC =
                CustomPacketPayload.codec((payload, buf) -> {
                    buf.writeVarInt(payload.ids().size());
                    payload.ids().forEach(id -> buf.writeUUID(id));
                }, buf -> {
                    int count = buf.readVarInt();
                    if (count < 0 || count > 10000) {
                        throw new IllegalArgumentException("Invalid badge user count: " + count);
                    }
                    Set<UUID> ids = new HashSet<>();
                    for (int i = 0; i < count; i++) {
                        ids.add(buf.readUUID());
                    }
                    return new Users(Set.copyOf(ids));
                });

        @Override
        public Type<Users> type() {
            return TYPE;
        }
    }

    @Override
    public void onInitialize() {
        PayloadTypeRegistry.serverboundPlay().register(Hello.TYPE, Hello.CODEC);
        PayloadTypeRegistry.clientboundPlay().register(Users.TYPE, Users.CODEC);

        ServerPlayNetworking.registerGlobalReceiver(Hello.TYPE, (payload, context) -> {
            USERS.add(context.player().getUUID());
            broadcast(context.server());
        });
        ServerPlayConnectionEvents.DISCONNECT.register((listener, server) -> {
            if (USERS.remove(listener.player.getUUID())) {
                broadcast(server);
            }
        });
    }

    private static void broadcast(MinecraftServer server) {
        Users payload = new Users(Set.copyOf(USERS));
        for (var player : server.getPlayerList().getPlayers()) {
            if (ServerPlayNetworking.canSend(player, Users.TYPE)) {
                ServerPlayNetworking.send(player, payload);
            }
        }
    }
}