mtr_addon:nte:js:util
Differences
This shows you the differences between two versions of the page.
Next revision | Previous revision | ||
mtr_addon:nte:js:util [2024/02/06 14:38] – another translation weryskok | mtr_addon:nte:js:util [2024/11/03 11:02] (current) – Fix getNTEVersionInt() errata lx862 | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== Utilities ====== | ====== Utilities ====== | ||
+ | |||
NTE provides a number of helper classes to provide some information or to implement functions more simply. | NTE provides a number of helper classes to provide some information or to implement functions more simply. | ||
===== Output of test information ===== | ===== Output of test information ===== | ||
+ | |||
* <code javascript> | * <code javascript> | ||
static print(params: | static print(params: | ||
Line 9: | Line 11: | ||
===== Versions ===== | ===== Versions ===== | ||
+ | |||
Functions are provided where you can get the version number to ensure compatibility with different versions of mods (if any). | Functions are provided where you can get the version number to ensure compatibility with different versions of mods (if any). | ||
+ | |||
^ Functions ^ Description ^ | ^ Functions ^ Description ^ | ||
| '' | | '' | ||
| '' | | '' | ||
- | | '' | + | | '' |
| '' | | '' | ||
===== TextUtil ===== | ===== TextUtil ===== | ||
+ | |||
MTR uses the station naming format '' | MTR uses the station naming format '' | ||
Line 32: | Line 37: | ||
===== Timing ===== | ===== Timing ===== | ||
+ | |||
* <code javascript> | * <code javascript> | ||
static Timing.elapsed(): | static Timing.elapsed(): | ||
Line 42: | Line 48: | ||
===== StateTracker ===== | ===== StateTracker ===== | ||
+ | |||
Sometimes it is necessary to take transition states into account. For example, to play an animation only once when a certain condition is reached (because '' | Sometimes it is necessary to take transition states into account. For example, to play an animation only once when a certain condition is reached (because '' | ||
- | Since each train must have its own tracker, you would probably want to store it in the train' | + | Since each train must have its own tracker, you would probably want to store it in the train' |
* <code javascript> | * <code javascript> | ||
Line 72: | Line 79: | ||
===== CycleTracker ===== | ===== CycleTracker ===== | ||
+ | |||
This is a '' | This is a '' | ||
- | Since each train must have its own tracker, you would probably want to store it in the train' | + | Since each train must have its own tracker, you would probably want to store it in the train' |
* <code javascript> | * <code javascript> | ||
Line 102: | Line 110: | ||
===== RateLimit ===== | ===== RateLimit ===== | ||
+ | |||
Some tasks do not require too frequent execution, for example, the display may not be updated every frame, but only 10 times per second. Therefore, you can limit the frequency of their execution to improve performance. | Some tasks do not require too frequent execution, for example, the display may not be updated every frame, but only 10 times per second. Therefore, you can limit the frequency of their execution to improve performance. | ||
- | Since each train must have its own data, you would probably want to store it in the train' | + | Since each train must have its own data, you would probably want to store it in the train' |
* <code javascript> | * <code javascript> | ||
Line 120: | Line 129: | ||
===== MTRClientData ===== | ===== MTRClientData ===== | ||
+ | |||
Client data from MTR that can be used to read routes, transfers, etc. See the source code of [[https:// | Client data from MTR that can be used to read routes, transfers, etc. See the source code of [[https:// | ||
===== MinecraftClient ===== | ===== MinecraftClient ===== | ||
+ | |||
Due to obfuscation, | Due to obfuscation, | ||
Line 137: | Line 148: | ||
</ | </ | ||
* Returns the in-game world time in ticks. | * Returns the in-game world time in ticks. | ||
+ | * <code javascript> | ||
+ | static MinecraftClient.narrate(message: | ||
+ | </ | ||
+ | * This calls the Minecraft narrator to narrate the message | ||
+ | * <code javascript> | ||
+ | static MinecraftClient.displayMessage(message: | ||
+ | </ | ||
+ | * This displays the message as an in-game chat message. If action bar is true, it will display on the action bar instead. (Above inventory hotbar) | ||
===== Source ===== | ===== Source ===== | ||
- | * https:// | + | |
+ | * [[https:// | ||
mtr_addon/nte/js/util.1707230327.txt.gz · Last modified: 2024/02/06 14:38 by weryskok