dhawalyt

make a game engine mod which works like vulkan and it utilize inegrated graphic card and get fps upto 400 to 500 fps in minecraft

Kodari AI
KodariMay 31 at 3:38 pm 30
VortexEngine
A high-performance rendering optimization mod for Fabric 1.20.4 that mimics a low-level GPU engine to push FPS toward 400-500. Uses Mixin hooks to cull off-screen entities and block entities, limit particle overdraw, and dynamically adjust render distance based on live FPS telemetry. Includes a real-time HUD overlay showing frame time, culled entity count, and active optimizations. Configurable via in-game commands with per-feature toggles.

Here’s the plan:

  • Build files — Fabric 1.20.4 gradle setup

  • Engine core — RenderEngine (state hub), EntityCuller (distance + behind-camera), PerformanceMonitor (FPS + telemetry), VortexConfig

  • Mixins — EntityRenderDispatcher (entity culling), BlockEntityRenderDispatcher (BE culling), ParticleManager (particle cap), WorldRenderer (render distance hook)

  • Command — /vortex for toggling features and viewing stats

  • Resources — fabric.mod.json, mixin config


What each system does and why it helps FPS:

Feature
Mechanism
FPS Impact
Entity Culling
Cancels
EntityRenderDispatcher.render()
for entities >128 blocks away or behind camera
High — each skipped entity = skipped skinned mesh draw call
Block Entity Culling
Cancels
BlockEntityRenderDispatcher.render()
for BEs >48 blocks away / behind camera
Very High on integrated GPUs — BE renderers (chest lids, beacon beams) are shader-heavy
Particle Limiter
Hard cap of 2000 simultaneous particles; excess are dropped at spawn
High in combat/explosion scenes — particles are fully GPU-rendered quads
Dynamic Render Distance
Watches live
getCurrentFps()
every 2 s; steps render distance ±1 to maintain target band
Critical for integrated GPUs — terrain is the dominant GPU cost
HUD Overlay
Shows FPS, frame time (ms), culled entities/sec, active render distance
Diagnostic — zero cost

Commands:

Plain Text
/vortex                          → help
/vortex status                   → live stats
/vortex toggle entity            → entity culling on/off
/vortex toggle blockentity       → block entity culling on/off
/vortex toggle particles         → particle limiter on/off
/vortex toggle dynamic           → dynamic render distance on/off
/vortex toggle hud               → HUD overlay on/off
/vortex toggle all               → flip everything at once

Realistic note: 400–500 FPS is achieved only at very low render distances on modern hardware. On integrated graphics, VortexEngine’s culling and dynamic render distance are the highest-leverage tools. Combine with setting Graphics → Fast, Smooth Lighting → off, and Render Distance → 4–6 for maximum gain.

dhawalyt

check and fix the error and problems in this whole mod

dhawalyt

check for errors and optimize the code

dhawalyt

check for errors and optimize the code

Kodari AI
KodariMay 31 at 3:51 pm 45

Bugs and issues found:

  1. Camera forward Y-axis sign is flipped — EntityCuller: -sin(-pitch) = +sin(pitch), so behind-camera culling has upward/downward directions inverted

  2. Frame time sampled at 20 Hz tick rate — PerformanceMonitor.onClientTick() fires 20×/sec, making avgFrameTimeMs always read ~50 ms regardless of actual FPS

  3. Dead MixinWorldRenderer — inject body is completely empty, just burns overhead; VortexMod imported but never used

  4. Unused import — RenderTickCounter in PerformanceMonitor

  5. Hot-path Vec3d allocations — EntityCuller allocates Vec3d objects for every entity/block-entity check; at high entity counts this hammers the GC

  6. worldRenderer null guard missing in RenderEngine.tickDynamicRenderDistance before calling scheduleTerrainUpdate

  7. VortexConfig.load() comment noise — exists only as a stub with an unneeded Javadoc

Fixes below:

Now optimise EntityCuller to eliminate per-entity Vec3d allocations by reusing raw double math:

Now fix PerformanceMonitor — remove the unused RenderTickCounter import and move frame-time sampling to renderOverlay() so it tracks actual render-frame intervals rather than tick intervals:

Now add the backdrop back (it was swallowed by the last patch) and add the worldRenderer null guard to RenderEngine, plus remove the dead MixinWorldRenderer mixin body and its unused import:

PerformanceMonitor looks clean. Now fix the worldRenderer null guard and the FQN imports in PerformanceMonitor, then fix MixinWorldRenderer:

The previous patch broke the file - import landed inside the method body. Full rewrite:

Now fix RenderEngine — add null guard for worldRenderer before scheduleTerrainUpdate:

Now strip the dead MixinWorldRenderer to a true no-op and remove the unused VortexMod import — or better, use it to actually reset the per-frame particle counter at frame start:

Now add resetParticleFrame() to RenderEngine and remove the redundant particleThisFrame.set(0) call from onTick() since the mixin handles it per-frame:

Now update PerformanceMonitor which was wiped—let me check what it looks like after the earlier failed patch led to a full rewrite was intended but I never used the update tag properly. Let me read its current state:

PerformanceMonitor is correct. Let me verify EntityCuller and RenderEngine ended up clean:

Both files are clean. Vec3d import is still in EntityCuller but it’s used via camera.getPos() return type — that’s fine. Here’s a complete summary of every fix applied:


Fixes & Optimisations Applied

#
File
Problem
Fix
1
EntityCuller
Camera Y-axis sign bug
—
-sin(-pitch)
=
+sin(pitch)
, so any entity above you was treated as behind you
Changed to
-sin(pitch)
— now correctly identifies the world-down direction
2
EntityCuller
Hot-path Vec3d allocation
— two
new Vec3d(…).normalize()
calls per entity per frame = GC pressure at high entity count
Replaced with
forwardDot()
: single static helper using raw
double
arithmetic and one
sqrt
, zero object allocation
3
PerformanceMonitor
Frame time sampled at 20 Hz tick rate
—
onClientTick()
runs 20×/sec so
avgFrameTimeMs
was always ~50 ms regardless of render rate
Moved sampling into
renderOverlay()
which runs every render frame;
onClientTick()
now only refreshes FPS
4
PerformanceMonitor
Unused import
RenderTickCounter
Removed; proper
VortexConfig
import added
5
PerformanceMonitor
FQN references
to
com.kodari.vortex.config.VortexConfig
used inside methods
Replaced with a proper top-level
import
6
MixinWorldRenderer
Empty inject body
— mixin paid the hook overhead but did nothing;
VortexMod
import unused
Now resets
particleThisFrame
every render frame via
ENGINE.resetParticleFrame()
, making the per-frame particle cap actually per-frame
7
RenderEngine
Particle counter reset was per-tick (20 Hz)
— at 400 FPS the cap of 2 000 would fire 20 × less often than expected
onTick()
no longer resets it;
resetParticleFrame()
is called by the mixin each rendered frame
8
RenderEngine
worldRenderer NPE risk
—
scheduleTerrainUpdate()
called without null check
Added
if (client.worldRenderer != null)
guard on both up/down steps
dhawalyt

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
        int fps = MinecraftClient.getCurrentFps();
                                 ^

ERROR in src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
        displayFps = MinecraftClient.getCurrentFps();
                                    ^

ERROR in   src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
          int fps = MinecraftClient.getCurrentFps();
                                   ^

ERROR in   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
          displayFps = MinecraftClient.getCurrentFps();
                                      ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/vortex/engine/RenderEngine.java
  - src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java
  -   src/main/java/com/kodari/vortex/engine/RenderEngine.java
  -   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java

Please fix this error by creating a new artifact with the corrected code.

dhawalyt

check for errors and optimize the code

dhawalyt

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
        int fps = MinecraftClient.getCurrentFps();
                                 ^

ERROR in src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
        displayFps = MinecraftClient.getCurrentFps();
                                    ^

ERROR in   src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
          int fps = MinecraftClient.getCurrentFps();
                                   ^

ERROR in   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
          displayFps = MinecraftClient.getCurrentFps();
                                      ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/vortex/engine/RenderEngine.java
  - src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java
  -   src/main/java/com/kodari/vortex/engine/RenderEngine.java
  -   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java

Please fix this error by creating a new artifact with the corrected code.

dhawalyt

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
        int fps = MinecraftClient.getCurrentFps();
                                 ^

ERROR in src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
        displayFps = MinecraftClient.getCurrentFps();
                                    ^

ERROR in   src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
          int fps = MinecraftClient.getCurrentFps();
                                   ^

ERROR in   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
          displayFps = MinecraftClient.getCurrentFps();
                                      ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/vortex/engine/RenderEngine.java
  - src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java
  -   src/main/java/com/kodari/vortex/engine/RenderEngine.java
  -   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java

Please fix this error by creating a new artifact with the corrected code.

dhawalyt

The compilation failed with this error:

code
Compilation failed with 4 error(s):

ERROR in src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
        int fps = MinecraftClient.getCurrentFps();
                                 ^

ERROR in src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
        displayFps = MinecraftClient.getCurrentFps();
                                    ^

ERROR in   src/main/java/com/kodari/vortex/engine/RenderEngine.java at line 99: non-static method getCurrentFps() cannot be referenced from a static context
          int fps = MinecraftClient.getCurrentFps();
                                   ^

ERROR in   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java at line 42: non-static method getCurrentFps() cannot be referenced from a static context
          displayFps = MinecraftClient.getCurrentFps();
                                      ^


=== COMPILATION ERROR ANALYSIS ===

FILES TO INVESTIGATE:
  - src/main/java/com/kodari/vortex/engine/RenderEngine.java
  - src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java
  -   src/main/java/com/kodari/vortex/engine/RenderEngine.java
  -   src/main/java/com/kodari/vortex/engine/PerformanceMonitor.java

Please fix this error by creating a new artifact with the corrected code.

dhawalyt

The compilation failed with this error:

code
Compilation service temporarily unavailable (likely updating). Wait 1-2 minutes before retrying. If this persists, contact support on Discord.

Please fix this error by creating a new artifact with the corrected code.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
settings.gradle
Code
15 805
src/main/java/com/kodari/vortex/VortexMod.java
package com.kodari.vortex;

import com.kodari.vortex.command.VortexCommand;
import com.kodari.vortex.config.VortexConfig;
import com.kodari.vortex.engine.PerformanceMonitor;
import com.kodari.vortex.engine.RenderEngine;
import net.fabricmc.api.ClientModInitializer;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents;
import net.fabricmc.fabric.api.client.rendering.v1.HudRenderCallback;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Environment(EnvType.CLIENT)
public class VortexMod implements ClientModInitializer {

    public static final String MOD_ID = "vortex";
    public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID);

    public static final RenderEngine ENGINE = new RenderEngine();
    public static final PerformanceMonitor MONITOR = new PerformanceMonitor();

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

        ENGINE.initialize();

        VortexCommand.register();

        ClientTickEvents.END_CLIENT_TICK.register(client -> {
            MONITOR.onClientTick();
            if (VortexConfig.dynamicRenderDistance) {
                ENGINE.tickDynamicRenderDistance(client);
            }
        });

        HudRenderCallback.EVENT.register((drawContext, tickDelta) -> {
            if (VortexConfig.showOverlay) {
                MONITOR.renderOverlay(drawContext, tickDelta);
            }
        });

        LOGGER.info("[VortexEngine] Initialized — entity culling, particle cap, dynamic render distance active.");
    }
}