Create Train Crash Fix
This mod fixes a critical error that can occur when creating trains in the Create modification. The problem manifests as a sudden server crash when train coordinates become infinite or undefined, even if the train data file displays correct values.
How the Fix Works
The developer discovered that the problem occurs during the data serialization process. Although the create_tracks.dat file contains correct coordinates, when creating the train entity they turn into NaN (Not a Number) values, leading to a crash.
An elegant solution was implemented through two mixins that intercept the entity creation process and NBT data reading. The main fix occurs in the createEntity method, where position coordinates are forcibly overwritten with correct values from positionAnchor before creating the train entity.
Technical Implementation
The mod uses the mixin system to inject the fix directly into Create's code. When invalid coordinates are detected, the system automatically replaces them with correct values, preventing the error from occurring.
This is a compact and efficient solution that does not affect performance and is compatible with other mods.