spear.yml

Create Coinvex Minecraft Mod — Fabric 1.21.11

Act as an expert Minecraft Fabric mod developer. Create a fully working Minecraft Java Edition mod named Coinvex for Minecraft 1.21.11 using Fabric Loader.

Main Feature

I play on a Minecraft server that has a /cf command to open a Coinflip GUI.

When I type /cf and the Coinflip GUI opens, the mod should display a line immediately below the Amount line on the relevant Coinflip item tooltip:

Win Chance = 54%

The percentage must be randomly generated between 1% and 99%.

Behaviour

  1. Detect when the player opens the Coinflip GUI using /cf.
  2. Identify the relevant Coinflip item by inspecting its tooltip text.
  3. Insert Win Chance = XX% directly below the Amount: line.
  4. Generate the random percentage once when the Coinflip GUI opens.
  5. Keep the percentage unchanged while the same GUI remains open.
  6. When the player closes the GUI and opens /cf again, generate a new random percentage.
  7. Do not display the line in unrelated inventories or menus.
  8. Use a readable green text style matching Minecraft GUI aesthetics.
  9. Make the mod client-side only. Do not require server installation or change server data.
  10. The mod must work on Minecraft Java 1.21.11 with Fabric.

Technical Requirements

* Mod name: Coinvex * Mod ID: coinvex * Java 21 * Use compatible Fabric API and Fabric Loom versions for Minecraft 1.21.11. * Use the correct Minecraft mappings and API signatures. * Detect the GUI using its title and tooltip content. Make the title and tooltip matching logic easy to configure because server menus may use different wording. * Prevent duplicate Win Chance lines. * Handle GUI closing and reopening correctly. * Do not crash if the tooltip, GUI title, or item is missing.

Mandatory Output

I need the compiled, working coinvex.jar, NOT just source code.

  1. Create the complete Gradle project.
  2. Compile it using a compatible JDK and Gradle environment.
  3. Resolve all compilation errors.
  4. Test that the mod builds successfully.
  5. Place the final JAR in a clearly named output folder.
  6. Provide a direct downloadable link to coinvex.jar.
  7. Also provide the source ZIP as an optional extra, not as the main deliverable.
  8. Do not claim the mod is compiled or tested unless the build actually succeeds.
  9. Do not provide a fake JAR, renamed ZIP, or empty file.

The final deliverable must be ready to place directly into the Minecraft mods folder alongside Fabric Loader and the compatible Fabric API.

If the environment cannot compile the mod, clearly explain the limitation and provide a working build workflow rather than pretending a JAR was generated.

Important: This is a cosmetic random number display only. Do not claim that it represents the server's actual probability of winning or affects the real Coinflip outcome.

Kodari AI
KodariOct 23 at 11:39 am 1
CoinvexWinChance
Client-side Fabric mod for Minecraft 1.21.11 that adds a "Win Chance = XX%" line to Coinflip item tooltips when the /cf GUI opens. Generates a random percentage (1-99%) once per GUI session, displays it in green below the Amount line, prevents duplicates, and handles GUI close/reopen. Configurable title and tooltip matching for server-specific menus. Cosmetic display only, does not affect actual game outcomes.
  1. Set up a client-only Fabric 1.21.11 project with Loom, Yarn mappings, Loader, and Fabric API.

  2. Track Coinflip screen changes by title and generate one 1–99% value per opening.

  3. Add the green line below matching Amount: tooltip text, avoiding duplicates and unrelated screens.

  4. Leave the compiled JAR unclaimed until Kodari’s build succeeds.

Implemented Coinvex as a client-only Fabric 1.21.11 mod. It matches Coinflip screen titles and Amount: tooltip lines; title and tooltip matchers are easy to adjust in CoinvexClient. The green 1–99% value stays fixed while that screen is open and is cosmetic only—it does not reflect or affect the server’s outcome.

No compiled JAR or source ZIP was produced or attached here, so I can’t provide a direct download link or claim the build was tested. To compile and download it in Kodari:

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

  2. Click Compile in the window that opens.

  3. After a successful build, click Download on that build or Download coinvex.jar in the chat.

spear.yml

Now make it as a actual mod it should display actual chance don't reset like every cf have different chance so tell that what's chance of winning it should not be random anymore make it a true mod

Kodari AI
KodariOct 23 at 11:46 am 1
  1. Remove the fabricated random value and read only an explicitly disclosed percentage from the matching Coinflip tooltip.

  2. If the server does not disclose an odds value, show no percentage rather than invent one.

Removed the random chance generation. Coinvex now reads an explicit percentage from a matching Coinflip tooltip and inserts it below Amount:. Chance labels are configurable in CoinvexClient.TOOLTIP_CHANCE_MATCHERS; it accepts values from 0% to 100% and avoids adding a duplicate Win Chance line.

A client-only mod cannot determine odds hidden in the server’s Coinflip logic. If the server does not disclose its chance in the tooltip, Coinvex now shows no invented percentage. I have not compiled or tested a JAR.

spear.yml

It should observe and give chance according to that every cf have different chance

Kodari AI
KodariOct 23 at 11:50 am 1

A client-only mod can observe past results, but it cannot learn the exact odds of a new, unique coinflip from those results. For example, 6 wins in 10 observed flips gives a 60% historical win rate—not proof that the next flip has a 60% chance. Each unique flip has only one outcome, which is not enough to infer its individual odds.

Coinvex can show either odds the server explicitly exposes, or a clearly labeled observed win rate for a group of comparable flips. To implement the latter reliably, I need the server’s exact win/loss messages and what should define a comparable group (for example, bet amount or player). Without those signals, showing a number would be guesswork.

spear.yml

When I'm pressing download button nothing happens

Kodari AI
KodariOct 23 at 11:53 am 1

There isn’t a compiled coinvex.jar available in this chat yet, so there’s no build to download. Click Compile in the top bar (on phone: ⋮ → Compile Project), then click Compile in the window. After a successful build, use Download on that build. If the download still doesn’t start, check your browser’s blocked-download indicator and allow downloads from Kodari.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
8 238
src/client/java/com/coinvex/client/CoinvexClient.java
package com.coinvex.client;

import java.util.ArrayList;
import java.util.List;
import java.util.Locale;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import net.minecraft.client.MinecraftClient;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.text.Text;
import net.minecraft.util.Formatting;

public final class CoinvexClient {
    public static final List<String> SCREEN_TITLE_MATCHERS = List.of("coinflip", "coin flip");
    public static final List<String> TOOLTIP_AMOUNT_MATCHERS = List.of("amount:");
    public static final List<String> TOOLTIP_CHANCE_MATCHERS = List.of(
            "win chance", "chance:", "chance =", "odds:", "odds =", "probability:", "probability =");

    private static final Pattern PERCENTAGE_PATTERN = Pattern.compile("(?<!\\d)(\\d{1,3})\\s*%");
    private static Screen trackedScreen;
    private static boolean coinflipScreenOpen;

    private CoinvexClient() {
    }

    public static void onScreenChanged(Screen screen) {
        if (screen == trackedScreen) {
            return;
        }

        trackedScreen = screen;
        coinflipScreenOpen = isCoinflipScreen(screen);
    }

    public static List<Text> decorateTooltip(List<Text> tooltip) {
        if (!coinflipScreenOpen
                || MinecraftClient.getInstance().currentScreen != trackedScreen
                || tooltip == null
                || tooltip.isEmpty()) {
            return tooltip;
        }

        int amountLine = -1;
        Integer disclosedChance = null;
        for (int i = 0; i < tooltip.size(); i++) {
            String line = tooltip.get(i).getString().toLowerCase(Locale.ROOT);
            if (line.contains("win chance")) {
                return tooltip;
            }
            if (amountLine == -1 && containsAny(line, TOOLTIP_AMOUNT_MATCHERS)) {
                amountLine = i;
            }
            if (disclosedChance == null && containsAny(line, TOOLTIP_CHANCE_MATCHERS)) {
                disclosedChance = parsePercentage(line);
            }
        }

        if (amountLine == -1 || disclosedChance == null) {
            return tooltip;
        }

        List<Text> decorated = new ArrayList<>(tooltip);
        decorated.add(amountLine + 1, Text.literal("Win Chance = " + disclosedChance + "%").formatted(Formatting.GREEN));
        return decorated;
    }

    private static Integer parsePercentage(String line) {
        Matcher matcher = PERCENTAGE_PATTERN.matcher(line);
        if (!matcher.find()) {
            return null;
        }

        int chance = Integer.parseInt(matcher.group(1));
        return chance <= 100 ? chance : null;
    }

    private static boolean isCoinflipScreen(Screen screen) {
        if (screen == null) {
            return false;
        }

        String title = screen.getTitle().getString().toLowerCase(Locale.ROOT);
        return containsAny(title, SCREEN_TITLE_MATCHERS);
    }

    private static boolean containsAny(String text, List<String> matchers) {
        for (String matcher : matchers) {
            if (text.contains(matcher.toLowerCase(Locale.ROOT))) {
                return true;
            }
        }
        return false;
    }
}