Create Optimized Trains

Create Optimized Trains — Performance optimization addon for Create Mod trains.
Back to Files

create-optimized-trains-1.3.1.jar

File namecreate-optimized-trains-1.3.1.jar
Uploaded
Jul 6, 2026
Downloads
1.0K
Size
743.0 KB
Mod Loaders
Forge
File ID
8382518
Type
B
Beta
Supported game versions
  • 1.20.1

Curse Maven Snippet

Forge

implementation fg.deobf("curse.maven:create-optimized-trains-1512235:8382518")

Learn more about Curse Maven

What's new

v1.3.1

Focus

  • Movement smoothness, simulation distance, LOD chunk radius, and rendering correctness
  • Rendering fixes target entity visibility and depth layering with Oculus/Embeddium + Flywheel OIT
  • Chunk loading and directional filtering improved for smoother train travel
  • Distant Horizons compatibility groundwork added

New Features

Train Simulation Distance

  • New simulation config section: simulationDistance (0–128 chunks) extends the directional chunk lookahead beyond the previous hardcoded 10-chunk limit
  • maxForcedChunks (20–400): configurable global cap for force-loaded chunks
  • Designed for use with Distant Horizons for smooth far-train visibility

Per-LOD Carriage Chunk Radius

  • New lod_radius config section: radiusFull, radiusMedium, radiusLow, radiusGhost
  • Load a larger or smaller chunk area around carriages depending on their LOD level
  • Replaces the single CARRIAGE_CHUNK_RADIUS option with fine-grained per-LOD control

Distant Horizons Compatibility

  • Added DistantHorizonsCompat to detect DH and coordinate chunk loading so the two systems do not conflict
  • Added ShaderCompat for lightweight detection of active shader packs (used by LOD and render decisions)

Player Train Tracker

  • Added PlayerTrainTracker utility to track which players are currently riding which trains
  • Used by chunk loading and LOD systems for proximity-aware decisions

Improvements

Movement Smoothness

  • Chunk boundary grace period is now adaptive: 5 ticks while moving, 20 ticks while stopped
  • Eliminates JourneyMap position lag and entity freeze at chunk boundaries
  • ContraptionTickThrottleMixin added to throttle tickContraption() safely without visual desync

Chunk Loading

  • ChunkMapMixin: added a 5-chunk minimum radius — directional filtering is now disabled entirely when the player is close to the train, preventing nearby chunks from being skipped
  • ChunkLoadManager: global forced-chunk cap increased from 30 to 60; lookahead cap increased from 6 to 10
  • TrainEventHandler: startup delay reduced from 100 to 40 ticks; ramp-up batch increased from 2 to 5
  • DirectionalChunkShaper: direction response made faster (smooth factor 0.3 → 0.5)
  • Default sideChunks increased from 3 to 5 in ModConfig

LOD System

  • LOD distances restored to v1.2.0 baseline (shaderLodShift default back to 0)
  • Fixed resolveCarriagePosition to use positionAnchor as a fallback when a carriage entity is not yet available
  • shouldAnimate now allows LOW LOD to animate; only GHOST skips animation
  • shouldSkipRender threshold lowered from 40 to 20 FPS

Rendering Performance

  • Removed Flywheel frame skipping from RenderOptimizer — positions now update every frame, eliminating position drift under load
  • CarriageRendererMixin: culling distance increased from 256 to 512 blocks

Bug Fixes

Camera Shake

  • Removed the isActiveChunkOrLoadedInManage Redirect that was causing camera shake when sitting in a moving carriage

Visual Throttle

  • Added NEAR_VISUAL_SKIP_RADIUS_SQ proximity guard so the visual throttle never fires for trains near the player/camera

Collision Throttle Intervals

  • TrainMixin: reduced collision throttle tick intervals from 4/8/12 to 2/4/8, making collisions more responsive

Chunk Grace Periods

  • CarriageMixin: chunk grace period reduced from 60 to 20 ticks
  • CarriageEntityMixin: bind grace period reduced from 40 to 15 ticks

Entity Visibility Through Contraption Glass (Oculus/Embeddium)

  • Entities were invisible when viewed through glass blocks on contraptions (trains with glass windows/doors)
  • Root cause: Flywheel's OIT pipeline writes its glass composite to the itemEntityTarget FBO. With Oculus, entity rendering is deferred into FullyBufferedMultiBufferSource — entities were not in the framebuffer when composite() ran
  • Fix: inject a flush of the Iris/Oculus batched entity source at popPush("blockentities") (priority 500, before Flywheel's priority 1000 hook), so entities are in the framebuffer when OIT composites the glass tint

Copycats+ Door Not Following Camera

  • Animated doors from Copycats+ were moving with the camera when mounted in a contraption
  • Root cause: translucentMovingBlock was routed through bufferSource(), which Oculus replaces with FullyBufferedMultiBufferSource. The Iris source is flushed at a different time, causing the door geometry to be drawn relative to camera movement
  • Fix: ContraptionBufferSourceWrapper now routes translucentMovingBlock to BufferSourceResolver.getRawMainBufferSource() — the vanilla raw BufferSource not replaced by Oculus — avoiding the infinite recursion that the Oculus getter substitution would otherwise cause

Entity Ghost / Wrong Layer Effect

  • Entities appeared ghost-like or at the wrong depth layer relative to block entities rendered after them
  • Root cause: the early entity flush was using depthMask(false), so entities did not write their own depth to the main FBO. Block entities rendered after Flywheel's OIT hook would pass the depth test where they shouldn't, appearing on top of entities
  • Fix: removed depthMask(false) from the entity flush — entities now write correct depth, giving proper layering

Copycats+ Door Wrong Depth Layer

  • With the entity flush corrected, the door remained at the wrong layer relative to contraption solid blocks
  • Root cause: the door was flushed with depthMask(false) before OIT, then OIT prepare() overwrote the item entity FBO depth — the door had no depth information when Iris composited itemEntityTarget onto the main FBO
  • Fix: the door is now flushed by OitFramebufferMixin at @HEAD of composite() (with depthMask(true) by default) and by LevelRendererPostFlywheelMixin (priority 1500) as a fallback when no OIT is active

Entities Invisible Through Copycats+ Door + Glass Combination

  • When a contraption had both Copycats+ doors and glass blocks, all entities seen through the door were invisible
  • Root cause: flushing the door to ITEM_ENTITY_TARGET before prepare() with depthMask(true) wrote door depth into the item entity FBO, interfering with the shared depth texture between the OIT FBO and item entity FBO
  • Fix: OitFramebufferMixin @HEAD flush fires after prepare() has already run, so the item entity FBO depth is clean before the door writes its own depth

Technical Details (Rendering)

  • Added BufferSourceResolver (reflection-based) to access RenderBuffers.f_110094_ directly, bypassing the Oculus getter substitution
  • Added ContraptionBufferSourceWrapper to centralise translucentMovingBlock and translucent rerouting during contraption render
  • Added FullyBufferedMultiBufferSourceMixin (@Pseudo) targeting both net.irisshaders and net.coderbot namespaces
  • OitDepthMixin: cancels renderDepthFromTransmittance() to prevent Flywheel OIT from writing synthetic glass depths
  • oit_composite_fix.js coremod: patches OitFramebuffer.composite() from depthMask(true) to depthMask(false)

Configuration

New config sections in create_optimized_trains-common.toml:

  • [simulation]simulationDistance, maxForcedChunks
  • [lod_radius]radiusFull, radiusMedium, radiusLow, radiusGhost
  • sideChunks default changed from 3 to 5
  • shaderLodShift default restored to 0

💚❇️Thank you so much to all of you for making this mod a success! And let's keep growing!

This mod has no additional files