diff --git a/src/main/java/me/ellieis/Sabotage/game/config/SabotageConfig.java b/src/main/java/me/ellieis/Sabotage/game/config/SabotageConfig.java index d83ae6a..48eeddf 100644 --- a/src/main/java/me/ellieis/Sabotage/game/config/SabotageConfig.java +++ b/src/main/java/me/ellieis/Sabotage/game/config/SabotageConfig.java @@ -5,19 +5,20 @@ import net.minecraft.util.Identifier; import xyz.nucleoid.plasmid.game.common.config.PlayerConfig; -public record SabotageConfig(Identifier map, int countdownTime, int gracePeriod, int timeLimit, int endDelay, int chestCount, InnocentConfig innocentConfig, DetectiveConfig detectiveConfig, SaboteurConfig saboteurConfig, PlayerConfig playerConfig) { +public record SabotageConfig(Identifier map, Identifier dimension, int countdownTime, int gracePeriod, int timeLimit, int endDelay, int chestCount, InnocentConfig innocentConfig, DetectiveConfig detectiveConfig, SaboteurConfig saboteurConfig, PlayerConfig playerConfig) { public static final Codec CODEC = RecordCodecBuilder.create(instance -> instance.group( Identifier.CODEC.fieldOf("map").forGetter(SabotageConfig::map), - Codec.INT.fieldOf("countdown_time").forGetter(SabotageConfig::countdownTime), - Codec.INT.fieldOf("grace_period").forGetter(SabotageConfig::gracePeriod), - Codec.INT.fieldOf("time_limit").forGetter(SabotageConfig::timeLimit), - Codec.INT.fieldOf("end_delay").forGetter(SabotageConfig::endDelay), + Identifier.CODEC.optionalFieldOf("dimension", new Identifier("minecraft:overworld")).forGetter(SabotageConfig::dimension), + Codec.INT.optionalFieldOf("countdown_time", 5).forGetter(SabotageConfig::countdownTime), + Codec.INT.optionalFieldOf("grace_period", 15).forGetter(SabotageConfig::gracePeriod), + Codec.INT.optionalFieldOf("time_limit", 1200).forGetter(SabotageConfig::timeLimit), + Codec.INT.optionalFieldOf("end_delay", 10).forGetter(SabotageConfig::endDelay), Codec.INT.fieldOf("chest_count").forGetter(SabotageConfig::chestCount), - InnocentConfig.CODEC.fieldOf("innocent").forGetter(SabotageConfig::innocentConfig), - DetectiveConfig.CODEC.fieldOf("detective").forGetter(SabotageConfig::detectiveConfig), - SaboteurConfig.CODEC.fieldOf("saboteur").forGetter(SabotageConfig::saboteurConfig), - PlayerConfig.CODEC.fieldOf("players").forGetter(SabotageConfig::playerConfig) + InnocentConfig.CODEC.optionalFieldOf("innocent", new InnocentConfig(20, 100, 20)).forGetter(SabotageConfig::innocentConfig), + DetectiveConfig.CODEC.optionalFieldOf("detective", new DetectiveConfig(20, 100, 100)).forGetter(SabotageConfig::detectiveConfig), + SaboteurConfig.CODEC.optionalFieldOf("saboteur", new SaboteurConfig(20, 100, 20)).forGetter(SabotageConfig::saboteurConfig), + PlayerConfig.CODEC.optionalFieldOf("players", new PlayerConfig(4, 64, 6, new PlayerConfig.Countdown(30, 5))).forGetter(SabotageConfig::playerConfig) ).apply(instance, SabotageConfig::new) ); } diff --git a/src/main/java/me/ellieis/Sabotage/game/phase/SabotageWaiting.java b/src/main/java/me/ellieis/Sabotage/game/phase/SabotageWaiting.java index 054ff47..b7d6c92 100644 --- a/src/main/java/me/ellieis/Sabotage/game/phase/SabotageWaiting.java +++ b/src/main/java/me/ellieis/Sabotage/game/phase/SabotageWaiting.java @@ -3,18 +3,15 @@ import me.ellieis.Sabotage.game.config.SabotageConfig; import me.ellieis.Sabotage.game.map.SabotageMap; import me.ellieis.Sabotage.game.map.SabotageMapBuilder; +import net.minecraft.registry.RegistryKey; +import net.minecraft.registry.RegistryKeys; import net.minecraft.server.MinecraftServer; import net.minecraft.server.network.ServerPlayerEntity; import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.Vec3d; import net.minecraft.world.GameMode; import xyz.nucleoid.fantasy.RuntimeWorldConfig; - -import xyz.nucleoid.plasmid.game.GameActivity; -import xyz.nucleoid.plasmid.game.GameOpenContext; -import xyz.nucleoid.plasmid.game.GameOpenProcedure; -import xyz.nucleoid.plasmid.game.GameSpace; -import xyz.nucleoid.plasmid.game.GameResult; +import xyz.nucleoid.plasmid.game.*; import xyz.nucleoid.plasmid.game.common.GameWaitingLobby; import xyz.nucleoid.plasmid.game.event.GameActivityEvents; import xyz.nucleoid.plasmid.game.event.GamePlayerEvents; @@ -56,6 +53,7 @@ public static GameOpenProcedure Open(GameOpenContext context) { SabotageMap map = SabotageMapBuilder.build(server, config.map(), config); RuntimeWorldConfig worldConfig = new RuntimeWorldConfig() .setGenerator(map.asChunkGenerator(server)) + .setDimensionType(RegistryKey.of(RegistryKeys.DIMENSION_TYPE, config.dimension())) .setTimeOfDay(6000); return context.openWithWorld(worldConfig, (activity, world) -> { diff --git a/src/main/resources/data/sabotage/games/hellbound.json b/src/main/resources/data/sabotage/games/hellbound.json index 495c5cb..b5a6928 100644 --- a/src/main/resources/data/sabotage/games/hellbound.json +++ b/src/main/resources/data/sabotage/games/hellbound.json @@ -1,26 +1,8 @@ { "type": "sabotage:sabotage", + "dimension": "minecraft:the_nether", "map": "sabotage:hellbound", - "countdown_time": 5, - "grace_period": 15, - "time_limit": 1200, - "end_delay": 10, "chest_count": 200, - "innocent": { - "innocent_karma_penalty": 20, - "detective_karma_penalty": 100, - "saboteur_karma_award": 20 - }, - "detective": { - "innocent_karma_penalty": 20, - "detective_karma_penalty": 100, - "saboteur_karma_award": 100 - }, - "saboteur": { - "innocent_karma_award": 20, - "detective_karma_award": 100, - "saboteur_karma_penalty": 20 - }, "players": { "min": 1, "max": 64, diff --git a/src/main/resources/data/sabotage/games/village.json b/src/main/resources/data/sabotage/games/village.json index ee0480e..d5e9495 100644 --- a/src/main/resources/data/sabotage/games/village.json +++ b/src/main/resources/data/sabotage/games/village.json @@ -1,29 +1,5 @@ { "type": "sabotage:sabotage", "map": "sabotage:village", - "countdown_time": 5, - "grace_period": 15, - "time_limit": 1200, - "end_delay": 10, - "chest_count": 125, - "innocent": { - "innocent_karma_penalty": 20, - "detective_karma_penalty": 100, - "saboteur_karma_award": 20 - }, - "detective": { - "innocent_karma_penalty": 20, - "detective_karma_penalty": 100, - "saboteur_karma_award": 100 - }, - "saboteur": { - "innocent_karma_award": 20, - "detective_karma_award": 100, - "saboteur_karma_penalty": 20 - }, - "players": { - "min": 1, - "max": 64, - "threshold": 6 - } + "chest_count": 125 } \ No newline at end of file