Skip to content

Commit

Permalink
More Trade Config
Browse files Browse the repository at this point in the history
Signed-off-by: Joseph T. McQuigg <[email protected]>
  • Loading branch information
JT122406 committed Dec 24, 2024
1 parent ed1e99c commit 737687a
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ public class BWGTradesConfig {

public static final BWGTradesConfig INSTANCE = ConfigLoader.loadConfig(BWGTradesConfig.class, "trades");

public BWGTrades trades = new BWGTrades();

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);
}

public BWGVillagerTradesConfig villagerTrades = new BWGVillagerTradesConfig();

public static class BWGVillagerTradesConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,11 @@ public static void init() {
ToolInteractions.registerTillables((block, pair) -> TillableBlockRegistry.register(block, pair.getFirst(), pair.getSecond()));
registerBiomeModifiers();
registerLootModifiers();
registerTrades();
registerWanderingTrades();
if (!BWGTradesConfig.INSTANCE.trades.disableTrades.value()) {
registerTrades();
if (BWGTradesConfig.INSTANCE.wanderingTraderTrades.enableBWGItemsTrades.value())
registerWanderingTrades();
}
FabricBrewingRecipeRegistryBuilder.BUILD.register(builder -> BWGBrewingRecipes.buildBrewingRecipes(builder::addMix));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
import net.potionstudios.biomeswevegone.forge.loot.LootModifiersRegister;
import net.potionstudios.biomeswevegone.forge.client.BiomesWeveGoneClientForge;
import net.potionstudios.biomeswevegone.world.entity.BWGEntities;
import net.potionstudios.biomeswevegone.world.entity.npc.BWGVillagerTrades;
import net.potionstudios.biomeswevegone.world.level.levelgen.biome.BWGOverworldSurfaceRules;
import net.potionstudios.biomeswevegone.world.level.levelgen.biome.BWGTerraBlenderRegion;
import terrablender.api.SurfaceRuleManager;
Expand Down Expand Up @@ -63,8 +62,6 @@ private void onInitialize(final FMLCommonSetupEvent event) {
*/
private void onPostInitialize(final FMLLoadCompleteEvent event) {
event.enqueueWork(BiomesWeveGone::postInit);
BWGVillagerTrades.makeTrades();
BWGVillagerTrades.makeWanderingTrades();
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,14 @@ public static void init() {
public static void registerVanillaCompatEvents(final IEventBus bus) {
bus.addListener(VanillaCompatForge::registerTillables);
bus.addListener(VanillaCompatForge::registerFuels);
bus.addListener(VanillaCompatForge::onVillagerTrade);
if (BWGTradesConfig.INSTANCE.wanderingTraderTrades.enableBWGItemsTrades.value()) bus.addListener(VanillaCompatForge::onWanderingTrade);
if (!BWGTradesConfig.INSTANCE.trades.disableTrades.value()) {
BWGVillagerTrades.makeTrades();
bus.addListener(VanillaCompatForge::onVillagerTrade);
if (BWGTradesConfig.INSTANCE.wanderingTraderTrades.enableBWGItemsTrades.value()) {
BWGVillagerTrades.makeWanderingTrades();
bus.addListener(VanillaCompatForge::onWanderingTrade);
}
}
bus.addListener(VanillaCompatForge::registerBrewingRecipes);
bus.addListener(VanillaCompatForge::onBoneMealUse);
bus.addListener(VanillaCompatForge::onEnderManAnger);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,14 @@ public static void init() {

public static void registerVanillaCompatEvents(final IEventBus bus) {
bus.addListener(VanillaCompatNeoForge::registerTillables);
bus.addListener(VanillaCompatNeoForge::onVillagerTrade);
if (BWGTradesConfig.INSTANCE.wanderingTraderTrades.enableBWGItemsTrades.value()) bus.addListener(VanillaCompatNeoForge::onWanderingTrade);
if (!BWGTradesConfig.INSTANCE.trades.disableTrades.value()) {
BWGVillagerTrades.makeTrades();
bus.addListener(VanillaCompatNeoForge::onVillagerTrade);
if (BWGTradesConfig.INSTANCE.wanderingTraderTrades.enableBWGItemsTrades.value()) {
BWGVillagerTrades.makeWanderingTrades();
bus.addListener(VanillaCompatNeoForge::onWanderingTrade);
}
}
bus.addListener(VanillaCompatNeoForge::onBoneMealUse);
bus.addListener(VanillaCompatNeoForge::registerBrewingRecipes);
bus.addListener(VanillaCompatNeoForge::onEnderManAnger);
Expand Down

0 comments on commit 737687a

Please sign in to comment.