W

You are an expert Java performance engineer and Minecraft Forge 1.8.9 client developer specializing in rendering optimization, JVM performance, LWJGL, and low-latency game programming.

Your objective is to design and implement an original Forge 1.8.9 client-side optimization mod focused on maximizing real-world performance, frame consistency, responsiveness, and overall smoothness comparable to highly optimized Minecraft clients.

Requirements

• Minecraft Forge 1.8.9 • Java 8 • Gradle project • Client-side only • Modular architecture • Every optimization can be individually enabled or disabled • Clean, well-documented, production-quality code

Performance Priorities (highest to lowest)

  1. Stable frametimes
  2. Low input latency
  3. Smooth camera movement
  4. High FPS
  5. Low memory usage

Rendering Optimizations

  • Optimize chunk rendering and rebuild scheduling
  • Reduce unnecessary OpenGL state changes
  • Reduce CPU-GPU synchronization stalls
  • Minimize redundant rendering work
  • Optimize texture binding
  • Improve render batching where possible
  • Eliminate microstutter during movement and turning

Entity Optimizations

  • Smart entity culling
  • Distance-based update throttling
  • Armor stand optimization
  • Tile entity optimization
  • Particle optimization with configurable limits
  • Skip unnecessary rendering calculations

Memory Optimizations

  • Reduce temporary object allocation
  • Reuse buffers whenever possible
  • Cache frequently used objects
  • Reduce garbage collection pressure
  • Avoid allocations inside render and tick loops

Threading

  • Safely move non-render-critical tasks off the main thread
  • Asynchronous resource preparation where safe
  • Thread-safe scheduling
  • Never violate Minecraft's rendering thread requirements

Tick Optimizations

  • Cache expensive lookups
  • Reduce redundant calculations
  • Optimize iteration over entities and collections
  • Preserve identical gameplay behavior

Configuration

Create a clean in-game INVENTORY GUI with categories:

• Rendering • Chunk Updates • Animations • Particles • Entity Optimization • Memory Optimization • Dynamic Optimization

Each option should include:

  • Toggle
  • Short description
  • Recommended default value

Development Standards

  • Follow clean architecture principles
  • Separate every optimization into independent packages/modules
  • Comment every optimization explaining:

- original bottleneck - implementation strategy - expected performance improvement - possible side effects

Kodari AI
KodariJun 23 at 3:08 am 106
KodariPerfMod
A comprehensive Forge 1.8.9 client-side performance optimization mod delivering stable frametimes, low input latency, and high FPS. Features entity frustum & distance culling, particle count limiting, precise frame pacing, AI update throttling, armor stand culling, tile entity culling, chunk rebuild rate limiting, GC management, animation toggles, and adaptive/background FPS control. All optimizations are individually toggleable via an in-game inventory-style GUI.

I’ll design every class dependency first, then produce all files in one generation.

Architecture:

  • PerfMod → loads ModConfig → instantiates 10 OptimizationModule impls → registers each to Forge event buses

  • ModConfig wraps Forge Configuration with typed accessors + adaptive-override layer

  • Category enum drives the GUI pages; ConfigOption represents each boolean toggle

  • GUI: GuiConfigMain (category chooser) + GuiConfigCategory (per-category toggles) — both extend GuiScreen, render chest background + NBT-tagged ItemStacks

  • PerfCommand (/perfmod) opens the main GUI from game chat



Here’s a summary of every file and what it delivers:


What was built

File
Purpose
build.gradle
ForgeGradle 2.1 project for Forge 1.8.9-11.15.1.2318
mcmod.info
Mod metadata
Category.java
7-value enum (Rendering → Dynamic) each with a display name, description, and ItemStack icon
ConfigOption.java
Single boolean toggle: id, name, description, default, recommended flag
ModConfig.java
Forge
Configuration
wrapper; all 20 bool options + 9 int values; adaptive-override layer for
DynamicModule
OptimizationModule.java
Interface:
register()
,
unregister()
,
getName()
EntityCullingModule
Distance + Frustum culling
—
RenderLivingEvent.Pre
; dirty-flag frustum updated once per frame via
Frustum.setPosition()
which reads live GL matrices
ParticleModule
Particle limiter
— type-scan reflection to find
EffectRenderer.fxLayers
, trims oldest particles from top layers when total > cap
FrameTimingModule
Frame pacer
— sleep + busy-spin to hit target FPS deadline with sub-ms precision
EntityUpdateModule
AI throttle
—
LivingUpdateEvent
cancellation: 50 % update at 64–128 blocks, 25 % beyond 128; bosses/players excluded
ArmorStandModule
Armor stand cull
— invisible, empty stands culled at 16 blocks; all stands at entity render distance
TileEntityModule
TESR cull
—
RenderTileEntityEvent.Pre
cancelled when TE distance >
te_render_dist
ChunkUpdateModule
Chunk rebuild limiter
— type-scan reflection on
RenderGlobal
’s
Set
; trims queue to
max_chunk_updates
entries per tick
MemoryModule
GC hints
— checks heap % every 5 s; calls
System.gc()
advisory hint when above threshold with 30 s cooldown
AnimationModule
Animation toggles
— view-bobbing override, smooth-camera override, rain particle scrubbing
DynamicModule
Adaptive + background FPS
—
Display.isActive()
background limiter; adaptive entity-distance override when FPS drops for 3 s
GuiConfigMain
Chest-style screen with 7 category buttons in 4+3 layout; click opens category screen
GuiConfigCategory
Per-category screen; lime/red wool per toggle; click toggles + refreshes; back + reset-defaults nav
PerfCommand
/perfmod
(
/kpm
) — opens GUI from any server, zero permissions
PerfMod
Main class; wires all 10 modules + command; logs each registration
Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
settings.gradle
Code
21 2,329
src/main/java/com/kodari/perfmod/PerfMod.java
package com.kodari.perfmod;

import com.kodari.perfmod.command.PerfCommand;
import com.kodari.perfmod.config.ModConfig;
import com.kodari.perfmod.optimization.OptimizationModule;
import com.kodari.perfmod.optimization.animation.AnimationModule;
import com.kodari.perfmod.optimization.chunk.ChunkUpdateModule;
import com.kodari.perfmod.optimization.dynamic.DynamicModule;
import com.kodari.perfmod.optimization.entity.ArmorStandModule;
import com.kodari.perfmod.optimization.entity.EntityUpdateModule;
import com.kodari.perfmod.optimization.entity.TileEntityModule;
import com.kodari.perfmod.optimization.memory.MemoryModule;
import com.kodari.perfmod.optimization.rendering.EntityCullingModule;
import com.kodari.perfmod.optimization.rendering.FrameTimingModule;
import com.kodari.perfmod.optimization.rendering.ParticleModule;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.Mod.Instance;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import net.minecraftforge.fml.impl.client.ClientCommandHandler;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * Kodari PerfMod — main Forge mod entry point.
 *
 * Lifecycle:
 * <ol>
 *   <li>{@code preInit} — load config from disk.</li>
 *   <li>{@code init}    — construct all optimization modules, register each to
 *                         the Forge event buses, and register the {@code /perfmod}
 *                         client command.</li>
 * </ol>
 *
 * Modules are stored in an unmodifiable {@link #modules} list so the GUI can
 * iterate them for display purposes without modifying the collection.
 */
@Mod(
        modid             = PerfMod.MODID,
        name              = PerfMod.NAME,
        version           = PerfMod.VERSION,
        clientSideOnly    = true,
        acceptedMinecraftVersions = "[1.8.9]"
)
public class PerfMod {

    public static final String MODID   = "kodari_perfmod";
    public static final String NAME    = "Kodari PerfMod";
    public static final String VERSION = "1.0.0";

    private static final Logger LOG = LogManager.getLogger(NAME);

    @Instance(MODID)
    public static PerfMod INSTANCE;

    private ModConfig config;
    private List<OptimizationModule> modules;

    // ── Lifecycle ─────────────────────────────────────────────────────────────

    @EventHandler
    public void preInit(FMLPreInitializationEvent event) {
        config = new ModConfig(event.getSuggestedConfigurationFile());
        config.load();
        LOG.info("{} configuration loaded.", NAME);
    }

    @EventHandler
    public void init(FMLInitializationEvent event) {
        List<OptimizationModule> list = new ArrayList<>();

        // Rendering
        list.add(new EntityCullingModule(config));
        list.add(new ParticleModule(config));
        list.add(new FrameTimingModule(config));

        // Entity
        list.add(new EntityUpdateModule(config));
        list.add(new ArmorStandModule(config));
        list.add(new TileEntityModule(config));

        // World
        list.add(new ChunkUpdateModule(config));

        // System
        list.add(new MemoryModule(config));
        list.add(new AnimationModule(config));

        // Dynamic / adaptive
        list.add(new DynamicModule(config));

        for (OptimizationModule module : list) {
            module.register();
            LOG.info("  [+] Registered module: {}", module.getName());
        }

        modules = Collections.unmodifiableList(list);

        // Register /perfmod client command (works on any server, no OP needed).
        ClientCommandHandler.instance.addCommand(new PerfCommand());

        LOG.info("{} v{} initialised — {} modules active.", NAME, VERSION, modules.size());
    }

    // ── Accessors ─────────────────────────────────────────────────────────────

    /** Returns the live configuration instance (never null after preInit). */
    public ModConfig getConfig() {
        return config;
    }

    /** Returns an unmodifiable view of all registered optimization modules. */
    public List<OptimizationModule> getModules() {
        return modules;
    }
}