Releases: DistrictOfJoban/Joban-Client-Mod
v2.2.0-beta.1
JCM v2.2.0-beta-1 for MTR 4.0.4 has been released!
Unless otherwise noted, all changes below pertains to the Scripting feature in JCM.
New (Non-Scripting)
During the development of JCM v2.2, several improvement area (Related to UX/performance/legacy NTE compatibility) in the main MTR mod were identified.
To ensure player gets the best in-game playing experience, several patches for MTR were integrate to JCM, which I will collectively call them the MTR Patch.
This allows faster delivery of bug-fixes/optimizations/improvements to MTR 4, while serving as a "playground" for these patches, so hopefully errors could be caught before they are merged into the main mod.
Applied patch as follows:
- MTR 3 / NTE Compatibility Improvements:
- Fix: NTE Eyecandy object now recognizes the "translation"/"rotation"/"scale"/"mirror" fields, which is used by NTE but does not get parsed correctly in MTR 4.
- Fix: For OBJ texture with path traversal (Like
..//..\), it is once again recognized, solving some missing texture issues when loading NTE packs.
- Enhancements: Improve model loading speed and memory usage for MTR.
- Enhancements: Minor frame-rate boost in complex world.
- Enhancements: Add car auto-filling in siding screen
- For supported vehicles, you can now hold SHIFT when adding vehicle cars to automatically fill out the entire siding length, with Cab, Trailer and Reversed Cab of the same train type being filled.
- Vehicles ending with id
cab_1,cab_2andtrailerare supported. - Similarly, you can hold SHIFT when deleting cars from siding to clear all cars.
New
- Vehicle Scripting
-
- Vehicle scripting has been added in this beta version.
-
- Backward compatibility with existing resource packs is on a best-effort basis. Some loads, some doesn't.
-
- API for NTE remains largely unchanged, with some new MTR 4 APIs developers can opt into.
-
- Mixed vehicle car operations is supported, alongside sharing script entries across multiple cars.
-
- See the Vehicle Scripting documentation for details, or try loading an MTR 3 scripted vehicle and see what needs to be ported.
- The Rhino JavaScript Engine has been updated to 1.9, bringing some performance improvements and more modern JS features.
- See the Rhino Compatibility Table for a list of supported features.
- Add
BackgroundWorkerto allow script to run task without blocking the main thread. - Add Console API
- Provide a slightly more rich API for logging, similar to the web's console API seen in browsers. (console.log, console.warn etc.)
- The
printfunction will be retained, redirects toconsole.logunder the hood. - The source/line no. of the print/console log statements may be viewed by enabling View Script Log Source in JCM's settings.
Resources.ensureStrFonts()now allows you to append an unlimited amount of AWT fallback fonts.- Add
MinecraftClient.spawnParticleInWorld()to spawn vanilla particles in the current world via scripts. - Add
MinecraftClient.renderDistance()to obtain the currently configured world render distance. - Add
MinecraftClient.getWorldPlayers()to obtain all player'sPlayerEntitywithin the current render distance. - Add
EyecandyBlockEntity.isCrosshairTarget()to indicate whether the player is looking at the the eyecandy.- Can be used to provide tooltips or additional information if needed.
- Add
hide_display_cube/hideDisplayParts(MTR 3 / MTR 4) vehicle properties to hide the displays, e.g those in built-in models.- Used to allow scripting to override built-in displays such as destination displays.
- Add more methods to get more detail for entities/players.
- JCM PIDS Scripting
- Add override for
Text.marquee(duration: double), allowing you to specify the marquee cycle duration in tick. - Add
Text.withMarqueeProgress(progress: double), allowing you to directly override the marquee progress. (0.0 - 1.0)
- Add override for
Changes
- A very minor change: JCM now always load scripts & PIDS Preset after MTR mod for consistency reason, I don't expect any user-facing changes.
- Improve speed for
GraphicsTexture.upload(), now it should be faster. - For script contexts (
ctxparameter), functions now conforms to theget/setprefix.ctx.renderManager()->ctx.getRenderManager()ctx.soundManager()->ctx.getSoundManager()- The existing non-get functions will be retained for backward compatibility reasons.
- Scripts in
mtr_custom_resources_pending_migration.jsonwill now also be recognized by JCM. Vector3fnow allows method chaining.- Breaking Changes: MTR 4 Eyecandy registration
- To conform better to the newly added vehicle scripting, the
scriptingobject will no longer be read for eyecandy objects in the MTR 4 format. Please see the new documentation for the new registration format. - MTR 3/NTE format remains non-affected
- To conform better to the newly added vehicle scripting, the
- Breaking Changes: Model Loading
- In previous versions of JCM, model loading in scripts are very limited, and can only load a single OBJ file. JCM v2.2 revises model loading to allow part of a model to be loaded, and allow limited amount of preprocessing before uploading the final model.
- This introduces the distinction between
ModelData(The raw model data) andModel(The finalized model uploaded to the GPU). Those who had been using NTE should feel home to these changes. (They are RawModel and ModelCluster respectively) ModelManager.loadModelnow only returnsModelData. To effectively use it in rendering functions, you have to obtain aModelby usingModelManager.upload(model: ModelData).
- Breaking Changes: Matrices
- All Matrices created by scripts are now flipped 180 degree along the X-axis when applying.
- For
Resources.getSystemFont, the font nameNoto Sans CJK TC Mediumcan now be used instead ofNoto Sansfor Noto Sans CJK (Deprecated in JCM v2.2)- Added font name
Noto Sans SemiBold, which returns MTR's Noto Sans SemiBold font (Non-CJK variant).
- Added font name
- Breaking Changes: TextUtil
TextUtil.getNonExtraParts()now returns the original string if no extra part is found, instead of an empty string.TextUtil.getNonCjkAndExtraParts()now actually returns the Non-CJK + extra part as documented, instead of "Non-extra Non-CJK part + Non-extra part".
- Data Loading Rework
- Previously, multiple functions exists for reading string/images in
ResourcesandNetworking, while theFilesAPI is only capable of reading string. - This has all been unified to
DataReader, a new class which represents a sequence of byte data. It offers option such asasString(),asBufferedImage(),asFont(),asByteArray()andasRawInputStream(), allowing developers to read them into a variety of formats. Resources.read()andNetworking.fetch()has been added which returns theDataReadervariant.Resources.readString(),Resources.readBufferedImage(),Resources.readFont(),Networking.fetchStringandNetworking.fetchImagehas been deprecated in favor of the DataReader functions.- Add
Resources.exist()to determine if a file exist in a resource pack.
- Previously, multiple functions exists for reading string/images in
- Breaking Changes: FileUtils
Files.readData()andFiles.read()now returns aDataReaderinstead of a string (See above)
Files.saveData()now allows BufferedImage as an argument for data to save.- (Non-Scripting) The JCM config has been remade, with several more options added:
- Add Disable Scripting to disable parsing JS scripts. Used for performance debugging / low-end devices.
- Add Script Debug Mode for JS scripts-specific debugging. (Debug Mode is now reserved for debug within JCM itself)
- Add Show log source for JS scripts, to trace where print/log statements originates from.
- Add Disable MTR Rail Rendering for performance diagnosing & providing a clearer view without rails.
- Add Hide currently riding vehicles for recording purposes, similar to NTE. (e.g. Cab-view recording)
- Existing config are migrated over to the new config. If you have enabled Debug Mode previously, Script Debug Mode will also be enabled by default.
- New config file is located under
.minecraft/config/jsblock/client.toml(Not relevant to most users)
Fixes
- (Non-scripting) Fix fare/ticket transaction log potentially erroring out, causing players to be stuck in a gate.
- Fix Eyecandy icon not being rendered when holding brush for scripted object.
- Fix QuadDrawCall
INTERIOR/INTERIOR_TRANSLUCENTrender type not applying full brightness. - Fix models & QuadDrawCall being rendered in full brightness in Scripted PIDS Preset
- Fix counter-intuitive
Matricespush/poping logic, which breaks many rendering stuff when used. - Fix
Networking.fetchString()being possible to hang indefinitely. - Fix
Files.saveData()not working with non-existent subdirectories.
Removal
- JCM build for Minecraft 1.16 has been fully dropped in the v2.2 series. Please update to a newer Minecraft version shall you wish to use JCM v2.2.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.2
JCM v2.1.2 for MTR 4.0.3 has been released!
New
- Scripting
-
- Add script quick reload, allowing reloading script without reloading the entire resource pack.
-
-
- JCM Debug Mode must be enabled before using.
-
-
-
- Shift+R: Reload JCM Scripts
-
-
-
- Ctrl+R: Reload MTR Scripts
-
Fixes
- Scripting
-
- Add
java.text.*package to whitelist, allowingAttributedStringto be used on AWT Graphics-based PIDS.
- Add
-
- Fix internal timer possibly rolling into the negatives after rejoining world, causing script with
RateLimitto not work properly for a short while.
- Fix internal timer possibly rolling into the negatives after rejoining world, causing script with
- Fix breaking incomplete/broken multipart block crashing the game.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.1
JCM v2.1.1 for MTR 4.0.2 has been released!
Fixes
- Fix Weather icon in JSON PIDS Preset being slightly off vertically
- Scripting:
-
- Fix Draw Calls offset potentially affecting position of another draw call
-
- Fix
MinecraftClient#localPlayer()being a non-static method, now you can invoke them directly like all other static method.
- Fix
-
- Fix RenderManager not applying equivalent transformation when used in JCM PIDS.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.0
JCM v2.1.0 for MTR 4.0.2 has been released!
New
- Add Help Line (Tseung Kwan O Line Type)
- The Script Debug Overlay now allows switching between sources (MTR/JCM) to provide a more clutter-free view.
-
- Default keybind is [ and ], can be changed in Minecraft keybind settings.
- Add Eyecandy Scripting, see documentations for details.
Changes
- Scripting Engine (Rhino)
-
- For Minecraft 1.17+, the Rhino engine has been updated to 1.8.0 which added more support for modern JS syntax. See this compatibility table for details.
- Script Execution:
-
- Script may now execute among 4 different threads.
-
- Note: The same type of script entry will always be executed on the same thread
- Slightly refactor the transaction history logic, should hopefully be a little more robust.
Misc
- Full Changelogs for Script Developers:
For Minecraft 1.16 players
Minecraft 1.16 has already been released for well over 4 years. While there are many efforts in the codebase to make JCM available for 1.16, it also puts a burden to maintain them.
- Feature parity for 1.16 will no longer be maintained. New script features/capabilities (Especially scripting engine related) may not be available on 1.16.
- Players who are still playing on 1.16 should consider upgrading to any newer version.
- When demands have become low enough, we may consider dropping 1.16 builds all-together.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.0-beta.3
JCM v2.1.0-beta.3 for MTR 4.0.2 has been released!
Note: Normal players are strongly advised to wait until the official release of v2.1.0.
Changes
- Script Execution:
-
- Script Execution are now changed so that the same type of script are executed orderly in the same thread (No longer parallelized per-instance). This should hopefully alleviate some multithreading issues with scripts.
- Slightly refactor the transaction history logics, should hopefully be a little more robust.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.0-beta.2
JCM v2.1.0-beta.2 for MTR 4.0.2 has been released!
Note: Normal players are strongly advised to wait until the official release of v2.1.0.
New (Scripting Implementation)
Scripting Engine
- Update to Rhino 1.8.1 (Minecraft 1.17+) & Rhino 1.7.15.1 (Minecraft 1.16.5)
-
- Fix a problem with formatting of floating-point numbers to strings that may result in very bad performance in some cases. (Rhino Changelog)
Execution
- Scripts may now execute across 4 different threads (Instead of only 1 background thread), which should improve the amount of scripts that can be executed simultaneously. (zbx1425 for the idea)
Networking
- Breaking change: A failed HTTP request via the
Networkingclass no longer throws an exception. -
- Use
NetworkResponse.success()to check whether the request succeeded
- Use
-
- Use
NetworkResponse.exception()to get the raw java exception.
- Use
- Add
NetworkResponse.ok()to check whether the response code returned by the server is successful. (HTTP Request Code >= 200 & <= 299)
Eyecandy Scripting
- Add
EyecandyBlockEntity.redstoneSignal()to process redstone signal in the block. -
- Note: This only returns 0 and 15 (lit & unlit) with the current implementation. Scripts should however account for future changes, where the true signal level is returned.
- Experimental: Add
EyecandyBlockEntity.setCollisionShape()to set the client-side collision shape of the block. -
- At most 1x1x1 (16x16x16 block unit), anything higher may cause the collision shape to not work as intended.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.1.0-beta.1
JCM v2.1.0-beta.1 for MTR 4.0.2 has been released!
New (Player features)
- Add Help Line (Tiu Keng Leng Station Type)
- The Script Debug Overlay now allows switching between sources (MTR/JCM) to provide a more clutter-free view.
-
- Default keybind is
[and], can be changed in Minecraft keybind settings.
- Default keybind is
- More scripting progress, implementation additions are outlined below.
-
- Major milestone reached:
-
-
- [v2.0.0] PIDS Preset Scripting
-
-
-
- [v2.1.0] Scripted Eyecandy displays (e.g. LCD screens) now possible with the use of QuadDrawCall.
-
-
-
- [v2.1.0] MTR 4 version of
mtr_custom_resources.jsonmay now register scripts!
- [v2.1.0] MTR 4 version of
-
New (Scripting Implementation)
Registration
- Eyecandy/Decoration Object scripts in the MTR 4 custom resource format can now be registered!
-
- See documentation for details!
- Added Script Input feature
-
scriptInput(MTR 3/NTE/JCM) /scripting.input(MTR 4) field can now be supplied in the json entry alongsidescriptFilesandscriptText.
-
- Anything within the field (JSON Object/Array/String) will be made accessible to the script via the
SCRIPT_INPUTvariable.
- Anything within the field (JSON Object/Array/String) will be made accessible to the script via the
-
- This is intended as a successor to
scriptTexts(w/ only variable declaration) and ANTE'sCONFIG_INFOfeature.
- This is intended as a successor to
Scripting Engine (Rhino)
- For Minecraft 1.17+, the Rhino JS engine has been updated to 1.8.0 which added more support for modern JS syntax. See this compatibility table for details.
- Minecraft 1.16.5 will remain on Rhino 1.7.15 due to the Java 8 requirement.
Sound
- Added a new
SoundManagerclass for all types of scripting. -
- Provide generic ways to play sound onto the Minecraft world.
ctx.playSound(),ctx.playCarSound()&ctx.playAnnSound()has been deprecated in favor of SoundManager.
Rendering
- Added a new
RenderManagerclass for all types of scripting. - Provide generic ways to draw 3D models or quads onto the Minecraft world
ctx.drawModel(),ctx.drawCarModel()andctx.drawConnModel()has been deprecated in favor of RenderManager.
Eyecandy Scripting
- Adapt RenderManager & SoundManager, can be accessed by
ctx.renderManager()&ctx.soundManager(), see above. - Add
EyecandyBlockEntity.pos()andEyecandyBlockEntity.blockPos()to determine where the eyecandy block is placed. - Allow setting custom outline shape with
ctx.setOutlineShape(shape: VoxelShape) - Add block use events for eyecandy
-
- Call
ctx.events().onBlockUse.occurred()to check, andctx.events().onBlockUse.detail()for event detail.
- Call
-
- Important: Acknowledge events with
ctx.events().handled()afterwards at suitable interval so the internal event state is reset.
- Important: Acknowledge events with
PIDS Scripting
- Adapt RenderManager & SoundManager, can be accessed by
ctx.renderManager()&ctx.soundManager(), see above. -
- This grants PIDS scripts the ability to render 3D OBJ model. It is advised to use this in conjunction with PIDS Projector, which is an invisible block.
- Add
PIDSBlockEntity.blockPos()to determine where the PIDS block is placed. - Add
PIDSBlockEntity.isKeyBlock()to determine if the current block is a unique block within a PIDS pair (e.g. Identify 1 side of a dual-sided PIDS)
Misc. Scripting Additions
- Added the Noto Sans CJK font that were previously shipped with NTE.
- Add
display_helper.jsbased on NTE's implementation. This should provide full backward compatibility for eyecandy using DisplayHelper, without manual interference needed for upgrade. - Add
Vector3ffor performing position-related operation. - Add
VanillaTextfor creating and styling minecraft-based text. (Bold/Italic/Colors etc.) -
- Add
MinecraftClient.displayMessage(text: VanillaText, actionBar: boolean)overload to display these text in chat or action bar, in addition to thestringvariant.
- Add
-
- This can be considered a substitute of
ComponentUtilin ANTE.
- This can be considered a substitute of
- Add
MinecraftClient.localPlayer(): PlayerEntityto retrieve more detailed info of the client player. - Add
MinecraftClient.getScoreboardScore(objective: string, playerName: string)to obtain the scoreboard score of a player. - Add
MinecraftClient.blockLightAt(pos: vector3f),MinecraftClient.skyLightAt(pos: vector3f),MinecraftClient.lightLevelAt(pos: vector3f)to determine light level in the world. - Add
MinecraftClient.gamePaused(): booleanto determine if the game has been paused. - Add
StateTracker.changedTo(state: any)andStateTracker.changedFromTo(fromState: any, toState: any)
Changes
- Scripting:
-
StateTrackernow accepts non-string values.
-
GraphicsTexture.upload()are now more optimized, should be mostly on-par with NTE.
-
- The
Networkingclass in JCM will no longer overwrite the User-Agent header if scripting restrictions is disabled.
- The
Fixes
- Fix script not disposed after leaving the game
- Fix
Timing.elapsed()only returning in-game tick values (i.e. in at least 50ms increments) -
- This also fix
RateLimitonly allowing a max update rate of 20 times per second caused by the above.
- This also fix
Documentations
As JCM v2.1 is still in beta, the documentation for the main site would continue to present v2 as the default.
To view the documentation for v2.1, please use the version selector on the top left of the page to access it.
The v2.1 scripting documentation has been slightly restructured. For existing PIDS Scripting users, this may take some time to get used to!
Content changes (Excluding restructuring):
- Add Scripting Guidelines page
- Add Migration from NTE page
- Add Script Debug Overlay page
- Add Display Helper page (Note: This is mostly translated from NTE's documentation)
- Add
Vector3fto Math Utilities page ResourceLocationhas now been renamed toIdentifieracross the documentations.- Remove the
wrappersuffix for class names, as they should be transparent to script developers -
PIDSWrapperhas been renamed toPIDSBlockEntity
-
ArrivalsWrapperhas been renamed toArrivalEntries
-
ArrivalWrapperhas been renamed toArrivalEntry
Important Note
For Minecraft 1.16 players
Minecraft 1.16 has already been released for well over 4 years. While there are many efforts in the codebase to make JCM available for 1.16, it also puts a burden to maintain them.
- Minecraft 1.16 will no longer receive first-class support like other versions.
- Feature parity will no longer be maintained. New script features/capabilities (Especially scripting engine related) may not be available on 1.16.
- Players who are still using Minecraft 1.16 should consider upgrading to any newer version.
- When demands have become low enough, we may consider dropping all 1.16 builds and CI all-together.
For other players
This is a beta release primarily for script developers to play around and give feedback on.
Normal players are strongly advised to wait until the official release of v2.1.0.
For Script Developers
Breaking changes may occur for all new features introduced during the v2.1.0 beta. JSON fields and scripting APIs may be moved, renamed, redesigned or scrapped at any point during beta releases.
You are more than encouraged to provide feedback for the newly introduced features (Yes, down to the naming!). Otherwise, no new breaking changes will be introduced after the official release, and any imperfections/annoyance that you perceive will stay with you forever :D
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.0.2
JCM v2.0.2 for MTR 4.0.0/4.0.1 has been released!
JCM v2.0.2 is a bug-fix release. Players using the older v2 version should update for the best experience.
Details as follows:
Fix:
- Allow PIDS 1A to be placed by regular MTR PIDS Pole again.
- Fix RV PIDS Pole not extending with slab on top.
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.0.1
JCM v2.0.1 for MTR 4.0.0/4.0.1 has been released!
JCM v2.0.1 is mostly a bug-fix release, details as follows:
Fix:
- PIDS Scripting
-
ArrivalWrapper.platforms()no longer return duplicated platform
-
sun.awt.*is now whitelisted to allow Awt RenderHints to work
- Fix a potential crash with RV PIDS
Download:
You can download this release on Modrinth, CurseForge or GitHub
v2.0.0
JCM v2.0.0 for MTR 4.0.0 has been released!
JCM v2.0.0 is a huge milestone for Joban Client Mod! The mod has been rewritten from the ground up with more features empowering players to express their creativity. For more details please view the full changelog.
Note that JCM v2.0.0 is only designed for MTR 4.0.0, and is therefore incompatible with MTR v3.x.
Conversely, JCM v1.x only supports MTR 3.x, and is incompatible with MTR v4.x.
Download:
You can download this release on Modrinth, CurseForge or GitHub