lwkontop

Create a high-performance Minecraft Fabric mod for version 1.21.4 called "Wuqis Crystal Optimizer".

The mod should optimize end crystal placement and breaking speed to feel approximately twice as fast as vanilla gameplay. When a player places and breaks a crystal once, it should behave as if it happens almost instantly or in rapid succession (simulating double speed where possible within game limits).

Core Features:

Optimize crystal placement and breaking timing Reduce delay between actions as much as possible (approach zero delay within safe limits) Improve responsiveness and input handling for crystal PvP Client-Side Boost (Visual Only):

Add an optional client-side-only boost mode that visually simulates an additional 2x speed increase This boost must NOT affect server-side logic (purely visual and animation-based) Should make crystal actions appear extremely fast and smooth Settings Menu:

Include a clean in-game INVENTORY GUI menu (Fabric-compatible, e.g. using Cloth Config or similar) All text must be in English Allow toggling:

Base optimizer (on/off) Client-side visual boost (on/off) Speed intensity slider (if possible) Simple and minimalistic design Performance:

Lightweight and optimized for PvP No unnecessary features Ensure compatibility with common Fabric APIs Additional Notes:

Focus on smoothness, responsiveness, and reduced perceived delay Avoid desync issues Keep code modular and well-structured

Kodari AI
KodariMay 3 at 3:19 pm 20,786 (v2)
WuqisCrystalOptimizer
A Fabric 1.21.4 client-side mod that optimizes end crystal placement and breaking speed for PvP. Features include a base optimizer that reduces action delays, an optional visual boost mode that makes crystal animations appear faster without affecting server logic, and an in-game inventory GUI settings menu. All settings are toggleable with a speed intensity slider. Lightweight and focused purely on crystal PvP responsiveness.

Let me read the necessary docs before writing any code.

Now I have everything I need. Let me plan the architecture:

  • Main initializer (empty, client-only mod)

  • Client initializer — registers keybind, tick listener, loads config

  • CrystalConfig — POJO with baseOptimizerEnabled, visualBoostEnabled, speedIntensity

  • CrystalConfigManager — Gson-based save/load

  • CrystalOptimizerScreen — custom inventory-style Screen GUI

  • MinecraftClientMixin — shadow itemUseCooldown, zero it in tick() based on config/speed

  • PlayerEntityMixin — modify getAttackCooldownProgress to return 1.0 when visual boost is on (client visual only)

The mod is fully set up with these components:

  • MinecraftClientMixin — hooks into MinecraftClient.tick() at HEAD and reduces/zeroes itemUseCooldown (the placement delay) each tick based on the speedIntensity slider. At 100% it is instant; at 50% it halves the cooldown per tick; at 0% it’s vanilla.

  • PlayerEntityMixin — hooks getAttackCooldownProgress(F)F at RETURN and forces it to return 1.0 when visual boost is on — this makes the attack sweep indicator always appear full on the client HUD with zero server-side effect.

  • CrystalOptimizerScreen — a custom Screen subclass rendering a dark-themed inventory-style panel with toggle buttons for Base Optimizer & Visual Boost, a +/- speed intensity bar (0–100% in 10% steps), and a close button.

  • WuqisCrystalOptimizerClient — registers the K keybind and a tick listener to open the GUI when no other screen is open.

  • Config is saved to .minecraft/config/wuqiscrystaloptimizer.json via Gson and is loaded once on startup and re-saved on every GUI interaction.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
12 539
src/client/java/com/wuqi/crystaloptimizer/WuqisCrystalOptimizerClient.java
package com.wuqi.crystaloptimizer;

import com.wuqi.crystaloptimizer.config.CrystalConfigManager;
import com.wuqi.crystaloptimizer.gui.CrystalOptimizerScreen;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper;
import net.minecraft.client.MinecraftClient;
import net.minecraft.client.option.KeyBinding;
import net.minecraft.client.util.InputUtil;
import org.lwjgl.glfw.GLFW;

public class WuqisCrystalOptimizerClient implements ClientModInitializer {

    private static KeyBinding openMenuKey;

    @Override
    public void onInitializeClient() {
        CrystalConfigManager.load();

        openMenuKey = KeyBindingHelper.registerKeyBinding(new KeyBinding(
                "key.wuqiscrystaloptimizer.open_menu",
                InputUtil.Type.KEYSYM,
                GLFW.GLFW_KEY_K,
                "Crystal Optimizer"
        ));

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            while (openMenuKey.wasPressed()) {
                if (client.currentScreen == null) {
                    client.setScreen(new CrystalOptimizerScreen());
                }
            }
        });
    }
}