Merge pull request #646 from Ghoulboy78/adding-game-data-version

Add game_data_version to system_info
This commit is contained in:
gnembon authored and GitHub committed 2020-12-28 22:37:40 -04:00
commit 2233dec197
2 files changed
+5 -2

No files matched your search

+3 -2
View File
@@ -488,7 +488,7 @@ it could either mean your input is wrong, or statistic effectively has a value o
### `system_info()`, `system_info(property)` ### `system_info()`, `system_info(property)`
Fetches the value of a system property or returns all inforation as a map when called without any arguments. It can be used to Fetches the value of a system property or returns all inforation as a map when called without any arguments. It can be used to
fetch various information, mostly not changing, or only available via low level fetch various information, mostly not changing, or only available via low level
system calls. In all cirumstances, these are only provided as read-only. system calls. In all circumstances, these are only provided as read-only.
Available options in the scarpet app space: Available options in the scarpet app space:
* `app_name` - current app name or `null` if its a default app * `app_name` - current app name or `null` if its a default app
@@ -506,7 +506,7 @@ Available options in the scarpet app space:
Relevant gameplay related properties Relevant gameplay related properties
* `game_difficulty` - current difficulty of the game: `'peacefu'`, `'easy'`, `'normal'`, or `'hard'` * `game_difficulty` - current difficulty of the game: `'peaceful'`, `'easy'`, `'normal'`, or `'hard'`
* `game_hardcore` - boolean whether the game is in hardcore mode * `game_hardcore` - boolean whether the game is in hardcore mode
* `game_storage_format` - format of the world save files, either `'McRegion'` or `'Anvil'` * `game_storage_format` - format of the world save files, either `'McRegion'` or `'Anvil'`
* `game_default_gamemode` - default gamemode for new players * `game_default_gamemode` - default gamemode for new players
@@ -514,6 +514,7 @@ Available options in the scarpet app space:
* `game_view_distance` - the view distance * `game_view_distance` - the view distance
* `game_mod_name` - the name of the base mod. Expect `'fabric'` * `game_mod_name` - the name of the base mod. Expect `'fabric'`
* `game_version` - base version of the game * `game_version` - base version of the game
* `game_data_version` - data version of the game. Returns an integer, so it can be compared.
Server related properties Server related properties
* `server_motd` - the motd of the server visible when joining * `server_motd` - the motd of the server visible when joining
@@ -13,6 +13,7 @@ import carpet.settings.ParsedRule;
import carpet.settings.SettingsManager; import carpet.settings.SettingsManager;
import com.sun.management.OperatingSystemMXBean; import com.sun.management.OperatingSystemMXBean;
import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.FabricLoader;
import net.minecraft.SharedConstants;
import net.minecraft.util.WorldSavePath; import net.minecraft.util.WorldSavePath;
import net.minecraft.world.GameRules; import net.minecraft.world.GameRules;
@@ -56,6 +57,7 @@ public class SystemInfo {
put("game_view_distance", c -> new NumericValue(c.s.getMinecraftServer().getPlayerManager().getViewDistance())); put("game_view_distance", c -> new NumericValue(c.s.getMinecraftServer().getPlayerManager().getViewDistance()));
put("game_mod_name", c -> StringValue.of(c.s.getMinecraftServer().getServerModName())); put("game_mod_name", c -> StringValue.of(c.s.getMinecraftServer().getServerModName()));
put("game_version", c -> StringValue.of(c.s.getMinecraftServer().getVersion())); put("game_version", c -> StringValue.of(c.s.getMinecraftServer().getVersion()));
put("game_data_version", c->NumericValue.of(SharedConstants.getGameVersion().getWorldVersion()));
put("server_ip", c -> StringValue.of(c.s.getMinecraftServer().getServerIp())); put("server_ip", c -> StringValue.of(c.s.getMinecraftServer().getServerIp()));
put("server_whitelisted", c -> new NumericValue(c.s.getMinecraftServer().isEnforceWhitelist())); put("server_whitelisted", c -> new NumericValue(c.s.getMinecraftServer().isEnforceWhitelist()));