-
-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Wandering trades, Trades Config Rework (#184)
* Start on WanderingTrades Signed-off-by: Joseph T. McQuigg <[email protected]> * Change Trades Config Signed-off-by: Joseph T. McQuigg <[email protected]> * Add Mushrooms, lily pads, and flowers to wandering traders Signed-off-by: Joseph T. McQuigg <[email protected]> * Update Config stuff Signed-off-by: Joseph T. McQuigg <[email protected]> * More Trade Config Signed-off-by: Joseph T. McQuigg <[email protected]> * Adjustments Signed-off-by: Joseph T. McQuigg <[email protected]> * ChangeLog Signed-off-by: Joseph T. McQuigg <[email protected]> * Fix some Issues with Null Issues Signed-off-by: Joseph T. McQuigg <[email protected]> --------- Signed-off-by: Joseph T. McQuigg <[email protected]>
- Loading branch information
Showing
10 changed files
with
127 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 17 additions & 22 deletions
39
Common/src/main/java/net/potionstudios/biomeswevegone/config/configs/BWGTradesConfig.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,28 @@ | ||
package net.potionstudios.biomeswevegone.config.configs; | ||
|
||
import com.google.common.base.Suppliers; | ||
import com.mojang.serialization.Codec; | ||
import com.mojang.serialization.codecs.RecordCodecBuilder; | ||
import corgitaco.corgilib.serialization.codec.CommentedCodec; | ||
import net.potionstudios.biomeswevegone.PlatformHandler; | ||
import net.potionstudios.biomeswevegone.config.ConfigLoader; | ||
import net.potionstudios.biomeswevegone.config.ConfigUtils; | ||
import org.jetbrains.annotations.NotNull; | ||
|
||
import java.nio.file.Path; | ||
import java.util.function.Supplier; | ||
public class BWGTradesConfig { | ||
|
||
public record BWGTradesConfig(boolean enableTrades, boolean enableVanillaTradeAdditions) { | ||
public static final BWGTradesConfig INSTANCE = ConfigLoader.loadConfig(BWGTradesConfig.class, "trades"); | ||
|
||
private static final Path PATH = PlatformHandler.PLATFORM_HANDLER.configPath().resolve("trades.json5"); | ||
public BWGTrades trades = new BWGTrades(); | ||
|
||
@NotNull | ||
public static Supplier<BWGTradesConfig> INSTANCE = Suppliers.memoize(BWGTradesConfig::getOrCreateConfigFromDisk); | ||
public static class BWGTrades { | ||
public ConfigUtils.CommentValue<Boolean> disableTrades = ConfigUtils.CommentValue.of("Disable All BWG Trades, If this is set to true none of the values below will matter", false); | ||
} | ||
|
||
private static final Codec<BWGTradesConfig> CODEC = RecordCodecBuilder.create(instance -> instance.group( | ||
CommentedCodec.of(Codec.BOOL, "enable_trades", "Whether to enable BWG Villager Trades").orElse(true).forGetter(config -> true), | ||
CommentedCodec.of(Codec.BOOL, "enable_vanilla_trade_additions", "Whether to add BWG Items to Vanilla Villager Type Trades").orElse(true).forGetter(config -> true) | ||
).apply(instance, BWGTradesConfig::new)); | ||
public BWGVillagerTradesConfig villagerTrades = new BWGVillagerTradesConfig(); | ||
|
||
private static BWGTradesConfig createDefault() { | ||
return new BWGTradesConfig(true, true); | ||
} | ||
public static class BWGVillagerTradesConfig { | ||
public ConfigUtils.CommentValue<Boolean> allowBWGForagerTrades = ConfigUtils.CommentValue.of("Allow BWG Forager Profession Trades", true); | ||
public ConfigUtils.CommentValue<Boolean> enableBWGVanillaProfessionTradeAdditions = ConfigUtils.CommentValue.of("Allows BWG Items to be added to Vanilla Profession Trades", true); | ||
} | ||
|
||
private static BWGTradesConfig getOrCreateConfigFromDisk() { | ||
return ConfigUtils.loadConfig(PATH, CODEC, createDefault()); | ||
} | ||
public BWGWanderingTraderTradesConfig wanderingTraderTrades = new BWGWanderingTraderTradesConfig(); | ||
|
||
public static class BWGWanderingTraderTradesConfig { | ||
public ConfigUtils.CommentValue<Boolean> enableBWGItemsTrades = ConfigUtils.CommentValue.of("Allows BWG Items to be added to Wandering Trader Offerings", true); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters