Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration screen #981

Open
wants to merge 1 commit into
base: 1.21
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/main/java/vectorwing/farmersdelight/FarmersDelight.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import net.neoforged.fml.common.Mod;
import net.neoforged.fml.config.ModConfig;
import net.neoforged.fml.loading.FMLEnvironment;
import net.neoforged.neoforge.client.gui.ConfigurationScreen;
import net.neoforged.neoforge.client.gui.IConfigScreenFactory;
import net.neoforged.neoforge.common.NeoForge;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand All @@ -30,6 +32,10 @@ public FarmersDelight(IEventBus modEventBus, ModContainer modContainer) {
modContainer.registerConfig(ModConfig.Type.COMMON, Configuration.COMMON_CONFIG);
modContainer.registerConfig(ModConfig.Type.CLIENT, Configuration.CLIENT_CONFIG);

if (FMLEnvironment.dist.isClient()) {
modContainer.registerExtensionPoint(IConfigScreenFactory.class, ConfigurationScreen::new);
}

ModSounds.SOUNDS.register(modEventBus);
ModBlocks.BLOCKS.register(modEventBus);
ModEffects.EFFECTS.register(modEventBus);
Expand Down
84 changes: 6 additions & 78 deletions src/main/java/vectorwing/farmersdelight/common/Configuration.java
Original file line number Diff line number Diff line change
Expand Up @@ -39,36 +39,16 @@ public class Configuration
public static final String CATEGORY_WORLD = "world";
public static ModConfigSpec.BooleanValue GENERATE_FD_CHEST_LOOT;
public static ModConfigSpec.BooleanValue GENERATE_VILLAGE_COMPOST_HEAPS;
public static ModConfigSpec.BooleanValue GENERATE_WILD_CABBAGES;
public static ModConfigSpec.IntValue CHANCE_WILD_CABBAGES;
public static ModConfigSpec.BooleanValue GENERATE_WILD_BEETROOTS;
public static ModConfigSpec.IntValue CHANCE_WILD_BEETROOTS;
public static ModConfigSpec.BooleanValue GENERATE_WILD_POTATOES;
public static ModConfigSpec.IntValue CHANCE_WILD_POTATOES;
public static ModConfigSpec.BooleanValue GENERATE_WILD_ONIONS;
public static ModConfigSpec.IntValue CHANCE_WILD_ONIONS;
public static ModConfigSpec.BooleanValue GENERATE_WILD_CARROTS;
public static ModConfigSpec.IntValue CHANCE_WILD_CARROTS;
public static ModConfigSpec.BooleanValue GENERATE_WILD_TOMATOES;
public static ModConfigSpec.IntValue CHANCE_WILD_TOMATOES;
public static ModConfigSpec.BooleanValue GENERATE_WILD_RICE;
public static ModConfigSpec.IntValue CHANCE_WILD_RICE;
public static ModConfigSpec.BooleanValue GENERATE_BROWN_MUSHROOM_COLONIES;
public static ModConfigSpec.IntValue CHANCE_BROWN_MUSHROOM_COLONIES;
public static ModConfigSpec.BooleanValue GENERATE_RED_MUSHROOM_COLONIES;
public static ModConfigSpec.IntValue CHANCE_RED_MUSHROOM_COLONIES;

// CLIENT
public static final String CATEGORY_CLIENT = "client";

public static ModConfigSpec.BooleanValue NOURISHED_HUNGER_OVERLAY;
public static ModConfigSpec.BooleanValue COMFORT_HEALTH_OVERLAY;
public static ModConfigSpec.BooleanValue FOOD_EFFECT_TOOLTIP;

static {
ModConfigSpec.Builder COMMON_BUILDER = new ModConfigSpec.Builder();

COMMON_BUILDER.comment("Game settings").push(CATEGORY_SETTINGS);
COMMON_BUILDER.push(CATEGORY_SETTINGS);
ENABLE_VANILLA_CROP_CRATES = COMMON_BUILDER.comment("Farmer's Delight adds crates (3x3) for vanilla crops, similar to Quark and Thermal Cultivation. Should they be craftable?")
.define("enableVanillaCropCrates", true);
FARMERS_BUY_FD_CROPS = COMMON_BUILDER.comment("Should Novice and Apprentice Farmers buy this mod's crops? (May reduce chances of other trades appearing)")
Expand All @@ -86,28 +66,28 @@ public class Configuration
.defineList("canvasSignDarkBackgroundList", ImmutableList.of("gray", "purple", "blue", "brown", "green", "red", "black"), obj -> true);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Farming").push(CATEGORY_FARMING);
COMMON_BUILDER.push(CATEGORY_FARMING);
DEFAULT_TOMATO_VINE_ROPE = COMMON_BUILDER.comment("Which rope should Tomato Vines leave behind when mined by hand?")
.define("defaultTomatoVineRope", "farmersdelight:rope");
ENABLE_TOMATO_VINE_CLIMBING_TAGGED_ROPES = COMMON_BUILDER.comment("Should tomato vines be able to climb any rope tagged as farmersdelight:ropes?",
"Beware: this will convert these blocks into the block specified in defaultTomatoVineRope.")
.define("enableTomatoVineClimbingTaggedRopes", true);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Recipe book").push(CATEGORY_RECIPE_BOOK);
COMMON_BUILDER.push(CATEGORY_RECIPE_BOOK);
ENABLE_RECIPE_BOOK_COOKING_POT = COMMON_BUILDER.comment("Should the Cooking Pot have a Recipe Book available on its interface?")
.define("enableRecipeBookCookingPot", true);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Vanilla item overrides").push(CATEGORY_OVERRIDES);
COMMON_BUILDER.push(CATEGORY_OVERRIDES);
VANILLA_SOUP_EXTRA_EFFECTS = COMMON_BUILDER.comment("Should soups and stews from vanilla Minecraft grant additional effects, like meals from this mod?")
.define("vanillaSoupExtraEffects", true);
RABBIT_STEW_BUFF = COMMON_BUILDER.comment("Should Rabbit Stew be buffed with improved food stats?")
.define("rabbitStewBuff", true);
DISPENSER_TOOLS_CUTTING_BOARD = COMMON_BUILDER.comment("Should the Dispenser be able to operate a Cutting Board in front of it?")
.define("dispenserUsesToolsOnCuttingBoard", true);

COMMON_BUILDER.comment("Stack size overrides").push(CATEGORY_OVERRIDES_STACK_SIZE);
COMMON_BUILDER.push(CATEGORY_OVERRIDES_STACK_SIZE);
ENABLE_STACKABLE_SOUP_ITEMS = COMMON_BUILDER.comment("Should BowlFoodItems in the following list become stackable to 16, much like Farmer's Delight's meals?")
.define("enableStackableSoupItems", true);
SOUP_ITEM_LIST = COMMON_BUILDER.comment("List of BowlFoodItems. They must extend this class to be affected. Default: vanilla soups and stews.")
Expand All @@ -116,75 +96,23 @@ public class Configuration

COMMON_BUILDER.pop();

COMMON_BUILDER.comment("World generation").push(CATEGORY_WORLD);
COMMON_BUILDER.push(CATEGORY_WORLD);
GENERATE_FD_CHEST_LOOT = COMMON_BUILDER.comment("Should this mod add some of its items (ropes, seeds, knives, meals etc.) as extra chest loot across Minecraft?")
.define("generateFDChestLoot", true);
GENERATE_VILLAGE_COMPOST_HEAPS = COMMON_BUILDER.comment("Generate Compost Heaps across all village biomes")
.define("genVillageCompostHeaps", true);

COMMON_BUILDER.comment("Wild Cabbage generation").push("wild_cabbages");
CHANCE_WILD_CABBAGES = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 30, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Sea Beet generation").push("wild_beetroots");
CHANCE_WILD_BEETROOTS = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 30, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Wild Potato generation").push("wild_potatoes");
CHANCE_WILD_POTATOES = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 100, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Wild Carrot generation").push("wild_carrots");
CHANCE_WILD_CARROTS = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 120, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Wild Onion generation").push("wild_onions");
CHANCE_WILD_ONIONS = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 120, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Tomato Vines generation").push("wild_tomatoes");
CHANCE_WILD_TOMATOES = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 100, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Wild Rice generation").push("wild_rice");
CHANCE_WILD_RICE = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 20, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Brown Mushroom Colony generation").push("brown_mushroom_colonies");
GENERATE_BROWN_MUSHROOM_COLONIES = COMMON_BUILDER.comment("Generate brown mushroom colonies on mushroom fields")
.define("genBrownMushroomColony", true);
CHANCE_BROWN_MUSHROOM_COLONIES = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 15, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.comment("Red Mushroom Colony generation").push("red_mushroom_colonies");
GENERATE_RED_MUSHROOM_COLONIES = COMMON_BUILDER.comment("Generate red mushroom colonies on mushroom fields")
.define("genRedMushroomColony", true);
CHANCE_RED_MUSHROOM_COLONIES = COMMON_BUILDER.comment("Chance of generating clusters. Smaller value = more frequent.")
.defineInRange("chance", 15, 0, Integer.MAX_VALUE);
COMMON_BUILDER.pop();

COMMON_BUILDER.pop();

COMMON_CONFIG = COMMON_BUILDER.build();

ModConfigSpec.Builder CLIENT_BUILDER = new ModConfigSpec.Builder();

CLIENT_BUILDER.comment("Client settings").push(CATEGORY_CLIENT);
NOURISHED_HUNGER_OVERLAY = CLIENT_BUILDER.comment("Should the hunger bar have a gilded overlay when the player has the Nourishment effect?")
.define("nourishmentHungerOverlay", true);
COMFORT_HEALTH_OVERLAY = CLIENT_BUILDER.comment("Should the health bar have a silver sheen when the player has the Comfort effect?")
.define("comfortHealthOverlay", true);
FOOD_EFFECT_TOOLTIP = CLIENT_BUILDER.comment("Should meal and drink tooltips display which effects they provide?")
.define("foodEffectTooltip", true);
CLIENT_BUILDER.pop();

CLIENT_CONFIG = CLIENT_BUILDER.build();
}
Expand Down
56 changes: 55 additions & 1 deletion src/main/resources/assets/farmersdelight/lang/en_us.json
Original file line number Diff line number Diff line change
Expand Up @@ -316,5 +316,59 @@
"farmersdelight.jei.info.wild_onions": "Onions can be commonly found as a wild plant in temperate lands, such as plains and forests.",
"farmersdelight.jei.info.wild_potatoes": "Potatoes can be commonly found as a wild plant in cold lands, such as mountains and taigas.",
"farmersdelight.jei.info.wild_tomatoes": "Tomatoes can be commonly found as a wild plant in arid lands, such as savannas and deserts.",
"farmersdelight.jei.info.wild_rice": "Rice can be commonly found as a wild plant in the ponds of wet lands, such as swamps and jungles."
"farmersdelight.jei.info.wild_rice": "Rice can be commonly found as a wild plant in the ponds of wet lands, such as swamps and jungles.",

"farmersdelight.configuration.settings": "Game settings",
"farmersdelight.configuration.enableVanillaCropCrates": "Enable vanilla crop crates",
"farmersdelight.configuration.enableVanillaCropCrates.tooltip": "Farmer's Delight adds crates (3x3) for vanilla crops, similar to Quark and Thermal Cultivation. Should they be craftable?",
"farmersdelight.configuration.farmersBuyFDCrops": "Enable Farmers to buy FD crops",
"farmersdelight.configuration.farmersBuyFDCrops.tooltip": "Should Novice and Apprentice Farmers buy this mod's crops? (May reduce chances of other trades appearing)",
"farmersdelight.configuration.wanderingTraderSellsFDItems": "Wandering Trader sells FD items",
"farmersdelight.configuration.wanderingTraderSellsFDItems.tooltip": "Should the Wandering Trader sell some of this mod's items? (Currently includes crop seeds and onions)",
"farmersdelight.configuration.richSoilBoostChance": "Rich Soil growth boost chance",
"farmersdelight.configuration.richSoilBoostChance.tooltip": "How often (in percentage) should Rich Soil succeed in boosting a plant's growth at each random tick? Set it to 0.0 to disable this.",
"farmersdelight.configuration.cuttingBoardFortuneBonus": "Cutting Board Fortune bonus",
"farmersdelight.configuration.cuttingBoardFortuneBonus.tooltip": "How much of a bonus (in percentage) should each level of Fortune grant to Cutting Board chances? Set it to 0.0 to disable this.",
"farmersdelight.configuration.enableRopeReeling": "Enable rope reeling",
"farmersdelight.configuration.enableRopeReeling.tooltip": "Should players be able to reel back rope, bottom to top, when sneak-using with an empty hand on them?",
"farmersdelight.configuration.canvasSignDarkBackgroundList": "Canvas Sign dark background list",
"farmersdelight.configuration.canvasSignDarkBackgroundList.tooltip": "A list of dye colors that, when used as the background of a Canvas Sign, should default to white text when placed. Dyes: [\"white\", \"orange\", \"magenta\", \"light_blue\", \"yellow\", \"lime\", \"pink\", \"gray\", \"light_gray\", \"cyan\", \"purple\", \"blue\", \"brown\", \"green\", \"red\", \"black\"]",

"farmersdelight.configuration.farming": "Farming",
"farmersdelight.configuration.defaultTomatoVineRope": "Default Tomato Vine rope",
"farmersdelight.configuration.defaultTomatoVineRope.tooltip": "Which rope should Tomato Vines leave behind when mined by hand?",
"farmersdelight.configuration.enableTomatoVineClimbingTaggedRopes": "Enable Tomato Vine climbing on tagged ropes",
"farmersdelight.configuration.enableTomatoVineClimbingTaggedRopes.tooltip": "Should tomato vines be able to climb any rope tagged as farmersdelight:ropes? Beware: this will convert these blocks into the block specified in defaultTomatoVineRope.",

"farmersdelight.configuration.recipe_book": "Recipe book",
"farmersdelight.configuration.enableRecipeBookCookingPot": "Enable Recipe Book for Cooking Pot",
"farmersdelight.configuration.enableRecipeBookCookingPot.tooltip": "Should the Cooking Pot have a Recipe Book available on its interface?",

"farmersdelight.configuration.overrides": "Vanilla item overrides",
"farmersdelight.configuration.vanillaSoupExtraEffects": "Enable vanilla soup extra effects",
"farmersdelight.configuration.vanillaSoupExtraEffects.tooltip": "Should soups and stews from vanilla Minecraft grant additional effects, like meals from this mod?",
"farmersdelight.configuration.rabbitStewBuff": "Enable Rabbit Stew buff",
"farmersdelight.configuration.rabbitStewBuff.tooltip": "Should Rabbit Stew be buffed with improved food stats?",
"farmersdelight.configuration.dispenserUsesToolsOnCuttingBoard": "Enable Dispenser to use tools on Cutting Board",
"farmersdelight.configuration.dispenserUsesToolsOnCuttingBoard.tooltip": "Should the Dispenser be able to operate a Cutting Board in front of it?",

"farmersdelight.configuration.stack_size": "Stack size overrides",
"farmersdelight.configuration.enableStackableSoupItems": "Enable stackable soup items",
"farmersdelight.configuration.enableStackableSoupItems.tooltip": "Should BowlFoodItems in the following list become stackable to 16, much like Farmer's Delight's meals?",
"farmersdelight.configuration.soupItemList": "List of stackable soup items",
"farmersdelight.configuration.soupItemList.tooltip": "List of BowlFoodItems. They must extend this class to be affected. Default: vanilla soups and stews.",

"farmersdelight.configuration.world": "World generation",
"farmersdelight.configuration.generateFDChestLoot": "Generate FD chest loot",
"farmersdelight.configuration.generateFDChestLoot.tooltip": "Should this mod add some of its items (ropes, seeds, knives, meals etc.) as extra chest loot across Minecraft?",
"farmersdelight.configuration.genVillageCompostHeaps": "Generate village Compost Heaps",
"farmersdelight.configuration.genVillageCompostHeaps.tooltip": "Generate Compost Heaps across all village biomes",

"farmersdelight.configuration.nourishmentHungerOverlay": "Enable Nourishment hunger overlay",
"farmersdelight.configuration.nourishmentHungerOverlay.tooltip": "Should the hunger bar have a gilded overlay when the player has the Nourishment effect?",
"farmersdelight.configuration.comfortHealthOverlay": "Enable Comfort health overlay",
"farmersdelight.configuration.comfortHealthOverlay.tooltip": "Should the health bar have a silver sheen when the player has the Comfort effect?",
"farmersdelight.configuration.foodEffectTooltip": "Enable food effect tooltips",
"farmersdelight.configuration.foodEffectTooltip.tooltip": "Should meal and drink tooltips display which effects they provide?"

}