make a minecraft mod that adds optimization like sodium and also adds tools that help in building
Let me read the required docs before writing any code.
Here’s my plan:
Build files —
gradle.properties,build.gradle,settings.gradleMain —
ApexOptimizer,ModItems,BuildersWandItem,ApexCommands,MobEntityMixinClient —
ApexOptimizerClient,ApexHudRendererResources —
fabric.mod.json, mixin config, lang, item definitions
The mod is fully structured. Here’s a summary of every feature:
Performance
MobEntityMixin— injects intoMobEntity.tickNewAi()and cancels AI evaluation every other tick for any mob that has no player within 48 blocks, cutting AI overhead roughly in half for background mobs.
Builder Tools
Builder’s Wand (
BuildersWandItem) — right-click any block face to flood-fill all connected same-type blocks on that plane (up to 64) and place new blocks extending outward in the clicked direction. Consumes blocks from inventory in survival, free in creative./apex replace <radius> <block>— raycasts to the block you’re looking at, then replaces every block of that type within the given radius with the specified block./apex fly— toggles flight on/off for yourself (requires op level 2)./apex fly speed <0.01–1.0>— sets your fly speed and enables flight. Default Minecraft fly speed is0.05(shown as1.0xin the HUD).
HUD Overlay
ApexHudRenderer— when flying, shows current speed as a multiplier (e.g.✈ Fly Speed: 2.0x). When the Builder’s Wand is in hand, shows a usage hint in the top-left corner.
Note: Place your wand texture PNG at
src/main/resources/assets/apexoptimizer/textures/item/builders_wand.png— without it the item will show a missing-texture purple/black checkerboard but will function correctly.
The compilation failed with this error:
Compilation failed with 4 error(s):
ERROR in src/main/java/com/apexoptimizer/command/ApexCommands.java at line 92: flySpeed has private access in PlayerAbilities
player.getAbilities().flySpeed = speed;
^
ERROR in src/main/java/client/java/com/apexoptimizer/hud/ApexHudRenderer.java at line 19: flySpeed has private access in PlayerAbilities
float speed = client.player.getAbilities().flySpeed;
^
ERROR in src/main/java/com/apexoptimizer/command/ApexCommands.java at line 92: flySpeed has private access in PlayerAbilities
player.getAbilities().flySpeed = speed;
^
ERROR in src/main/java/client/java/com/apexoptimizer/hud/ApexHudRenderer.java at line 19: flySpeed has private access in PlayerAbilities
float speed = client.player.getAbilities().flySpeed;
^
=== COMPILATION ERROR ANALYSIS ===
FILES TO INVESTIGATE:
- src/main/java/com/apexoptimizer/command/ApexCommands.java
- src/main/java/client/java/com/apexoptimizer/hud/ApexHudRenderer.java
- src/main/java/com/apexoptimizer/command/ApexCommands.java
- src/main/java/client/java/com/apexoptimizer/hud/ApexHudRenderer.java
Please fix this error by creating a new artifact with the corrected code.
PlayerAbilities.flySpeed is a private field in 1.21.4 — the correct accessors are getFlySpeed() and setFlySpeed(float).
Replaced the direct flySpeed field access with setFlySpeed(speed) in ApexCommands.java and getFlySpeed() in ApexHudRenderer.java.
package com.apexoptimizer;
import com.apexoptimizer.hud.ApexHudRenderer;
import net.fabricmc.api.ClientModInitializer;
public class ApexOptimizerClient implements ClientModInitializer {
@Override
public void onInitializeClient() {
ApexHudRenderer.register();
}
}