From edab4440e2342416f5cb6775cbcdc014187d6524 Mon Sep 17 00:00:00 2001 From: Forstride Date: Mon, 4 Mar 2024 01:22:17 -0500 Subject: [PATCH] Added config to disable BOP's Wandering Trader trades (Closes #2184) --- .../biomesoplenty/config/GameplayConfig.java | 25 +++++++++++++++++++ .../biomesoplenty/core/BiomesOPlenty.java | 2 +- .../java/biomesoplenty/init/ModConfig.java | 2 ++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 common/src/main/java/biomesoplenty/config/GameplayConfig.java diff --git a/common/src/main/java/biomesoplenty/config/GameplayConfig.java b/common/src/main/java/biomesoplenty/config/GameplayConfig.java new file mode 100644 index 000000000..6c731274a --- /dev/null +++ b/common/src/main/java/biomesoplenty/config/GameplayConfig.java @@ -0,0 +1,25 @@ +/******************************************************************************* + * Copyright 2024, the Glitchfiend Team. + * All rights reserved. + ******************************************************************************/ +package biomesoplenty.config; + +import biomesoplenty.core.BiomesOPlenty; +import glitchcore.config.Config; +import glitchcore.util.Environment; + +public class GameplayConfig extends Config +{ + public boolean wanderingTraderTrades; + + public GameplayConfig() + { + super(Environment.getConfigPath().resolve(BiomesOPlenty.MOD_ID + "/gameplay.toml")); + } + + @Override + public void load() + { + wanderingTraderTrades = add("general.wandering_trader_trades", true, "Add various BOP resources to the Wandering Trader trade pool."); + } +} diff --git a/common/src/main/java/biomesoplenty/core/BiomesOPlenty.java b/common/src/main/java/biomesoplenty/core/BiomesOPlenty.java index 572c8f97f..1415b1bb3 100644 --- a/common/src/main/java/biomesoplenty/core/BiomesOPlenty.java +++ b/common/src/main/java/biomesoplenty/core/BiomesOPlenty.java @@ -49,7 +49,7 @@ private static void addRegistrars() private static void addHandlers() { // Misc handlers - EventManager.addListener(ModVillagerTrades::addWanderingVillagerTrades); + if (ModConfig.gameplay.wanderingTraderTrades) { EventManager.addListener(ModVillagerTrades::addWanderingVillagerTrades); } if (Environment.isClient()) { diff --git a/common/src/main/java/biomesoplenty/init/ModConfig.java b/common/src/main/java/biomesoplenty/init/ModConfig.java index 1b61997a6..43f8e5818 100644 --- a/common/src/main/java/biomesoplenty/init/ModConfig.java +++ b/common/src/main/java/biomesoplenty/init/ModConfig.java @@ -5,6 +5,7 @@ package biomesoplenty.init; import biomesoplenty.api.biome.BOPBiomes; +import biomesoplenty.config.GameplayConfig; import biomesoplenty.config.GenerationConfig; import biomesoplenty.core.BiomesOPlenty; import biomesoplenty.util.config.JsonUtil; @@ -30,6 +31,7 @@ public class ModConfig private static final TreeMap defaultBiomeToggles = Maps.newTreeMap(); public static GenerationConfig generation = new GenerationConfig(); + public static GameplayConfig gameplay = new GameplayConfig(); public static void setup() {