From 5c5851ce8441bced76c6abb2bd9cbfbbfedb01c9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9o=20Kosman?= Date: Sat, 24 Aug 2024 13:11:15 +0200 Subject: feat: config fields and gamerules related to world borders --- .../java/world/anhgelus/molehunt/Molehunt.java | 17 ++++++++++++++++- .../world/anhgelus/molehunt/config/Config.java | 22 ++++++++++++++++++++++ 2 files changed, 38 insertions(+), 1 deletion(-) (limited to 'src/main/java/world/anhgelus') diff --git a/src/main/java/world/anhgelus/molehunt/Molehunt.java b/src/main/java/world/anhgelus/molehunt/Molehunt.java index d7c0d58..7e6ce81 100644 --- a/src/main/java/world/anhgelus/molehunt/Molehunt.java +++ b/src/main/java/world/anhgelus/molehunt/Molehunt.java @@ -39,7 +39,7 @@ public class Molehunt implements ModInitializer { public static final SimpleConfig CONFIG_FILE = Config.configFile(MOD_ID); public static final GameRules.Key GAME_DURATION = GameRuleRegistry.register( - MOD_ID +":gameDuration", + MOD_ID +":gameDurationMinutes", GameRules.Category.MISC, GameRuleFactory.createIntRule(CONFIG_FILE.getOrDefault("game_duration", 90)) ); @@ -77,6 +77,21 @@ public class Molehunt implements ModInitializer { CONFIG.sendConfigPayload(); }) ); + public static final GameRules.Key INITIAL_WORLD_SIZE = GameRuleRegistry.register( + MOD_ID +":initialWorldSize", + GameRules.Category.MISC, + GameRuleFactory.createIntRule(CONFIG_FILE.getOrDefault("initial_world_size", 200), 0) + ); + public static final GameRules.Key FINAL_WORLD_SIZE = GameRuleRegistry.register( + MOD_ID +":finalWorldSize", + GameRules.Category.MISC, + GameRuleFactory.createIntRule(CONFIG_FILE.getOrDefault("final_world_size", 50), 0) + ); + public static final GameRules.Key SHRINKING_STARTING_OFFSET = GameRuleRegistry.register( + MOD_ID +":borderShrinkingStartingOffsetMinutes", + GameRules.Category.MISC, + GameRuleFactory.createIntRule(CONFIG_FILE.getOrDefault("border_shrinking_starting_offset", 10), 0) + ); public Game game; diff --git a/src/main/java/world/anhgelus/molehunt/config/Config.java b/src/main/java/world/anhgelus/molehunt/config/Config.java index dbaebcf..eedb659 100644 --- a/src/main/java/world/anhgelus/molehunt/config/Config.java +++ b/src/main/java/world/anhgelus/molehunt/config/Config.java @@ -57,7 +57,10 @@ public class Config { private static String defaultConfig(String s) { return """ # Molehunt mod configuration file + # To regenerate the default configuration, delete, move or rename this file. + # Game settings + # The duration of a molehunt game, in minutes. # Default: 90 minutes (1 hour 30 minutes). game_duration = 90 @@ -73,6 +76,9 @@ public class Config { # Default: -1. mole_count = -1 + + # Client-side settings (applies to all players) + # Show nametags # Default: false show_nametags = false @@ -84,6 +90,22 @@ public class Config { # Show tab # Default: false show_tab = false + + + # World border settings : + + # Initial world size (in blocks). + # Default: 200 blocks. + initial_world_size = 200 + + # Final world size (in blocks). + # Default: 50 blocks. + final_world_size = 50 + + # Shrinking starting offset (in minutes) + # The time before starting to shrink the world borders. + # Default: 10 minutes. + border_shrinking_starting_offset = 10 """; } } -- cgit v1.2.3