D

Develop a Minecraft Java mod called "Roleta da Speedrun — Random Challenge" using Fabric that features an interactive roulette wheel for selecting random items with three difficulty levels: Easy (spin every 5 minutes), Medium (every 7 minutes), and Hard (every 10 minutes). The mod should include animations, a spin button, highlighted results, a visible timer, sound effects, special effects for rare items, and a variety of item categories from Minecraft. Players must choose their difficulty before starting, spins should be restricted based on the timer, and the selected difficulty along with the timer should persist throughout the game session. Ensure the code is well-organized, the interface is functional, and all necessary files for creating an installable JAR are included.

Kodari AI
KodariNov 3 at 12:07 pm 3
SpeedrunRoulette
SpeedrunRoulette is a Fabric mod that adds an interactive roulette wheel to Minecraft, challenging players with random item selections. Players choose from three difficulty levels—Easy (5-minute cooldown), Medium (7-minute), and Hard (10-minute)—before spinning. The mod features a fully animated wheel with a spin button, highlighted results, visible countdown timer, sound effects, and special visual effects for rare items. It includes diverse item categories from vanilla Minecraft, restricts spins based on the active timer, and persists the selected difficulty and timer across the game session. The mod provides a complete, well-organized interface and all necessary files for building an installable JAR.
  1. Set up the Fabric 26.3 mod and client entry points.

  2. Build an owo-ui roulette screen with three timed difficulties, spin animation, rare-result feedback, and a persistent in-session timer.

  3. Add a compact HUD timer and the required mod metadata/dependency files.

Created Roleta da Speedrun — Random Challenge as a client-side Fabric 26.3 mod.

  • Press P to open the owo-ui roulette. Choose Easy (5 minutes), Medium (7 minutes), or Hard (10 minutes), then start and spin when the timer allows.

  • The animated item reveal covers food, materials, combat gear, and rare items. Rare results get a special highlight and sound.

  • The difficulty and cooldown remain active when you close and reopen the screen; the timer also appears on the HUD. Use Reset Session to choose again.

  • Added the Fabric build configuration, mod metadata, and owo-lib bundle manifest needed for the project.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
8 659
src/client/java/com/kodari/roletaspeedrun/RoletaSpeedrunClient.java
package com.kodari.roletaspeedrun;

import io.wispforest.owo.ui.component.LabelComponent;
import io.wispforest.owo.ui.component.UIComponents;
import io.wispforest.owo.ui.container.FlowLayout;
import io.wispforest.owo.ui.container.UIContainers;
import io.wispforest.owo.ui.core.Insets;
import io.wispforest.owo.ui.core.Positioning;
import io.wispforest.owo.ui.core.Sizing;
import io.wispforest.owo.ui.core.Surface;
import io.wispforest.owo.ui.hud.Hud;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keymapping.v1.KeyMappingHelper;
import net.minecraft.client.KeyMapping;
import net.minecraft.network.chat.Component;
import net.minecraft.resources.Identifier;
import com.mojang.blaze3d.platform.InputConstants;

public class RoletaSpeedrunClient implements ClientModInitializer {

    private static final KeyMapping OPEN_ROULETTE = KeyMappingHelper.registerKeyMapping(
            new KeyMapping("key.roleta_speedrun.open", InputConstants.Type.KEYBOARD, InputConstants.KEY_P, KeyMapping.Category.MISC)
    );
    private static LabelComponent hudLabel;
    private static String lastHudText = "";
    private static int hudTicks;

    @Override
    public void onInitializeClient() {
        Hud.add(Identifier.fromNamespaceAndPath("roleta_speedrun", "challenge_timer"), () -> {
            hudLabel = UIComponents.label(Component.literal(RouletteSession.hudText()));
            hudLabel.shadow(true);

            FlowLayout panel = UIContainers.verticalFlow(Sizing.content(), Sizing.content());
            panel.child(hudLabel);
            panel.padding(Insets.of(5));
            panel.surface(Surface.DARK_PANEL);
            panel.positioning(Positioning.absolute(8, 8));
            return panel;
        });

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            RouletteSession.tick();
            if (OPEN_ROULETTE.consumeClick())
                client.gui.setScreen(new RouletteScreen());

            if (++hudTicks % 10 != 0 || hudLabel == null)
                return;

            String text = RouletteSession.hudText();
            if (text.equals(lastHudText))
                return;

            lastHudText = text;
            hudLabel.text(Component.literal(text));
        });
    }
}