| 15 | // An example config class. This is not required, but it's a good idea to have one to keep your config organized. |
| 16 | // Demonstrates how to use Neo's config APIs |
| 17 | public class Config { |
| 18 | private static final ModConfigSpec.Builder BUILDER = new ModConfigSpec.Builder(); |
| 19 | |
| 20 | public static final ModConfigSpec.BooleanValue LOG_DIRT_BLOCK = BUILDER |
| 21 | .comment("Whether to log the dirt block on common setup") |
| 22 | .define("logDirtBlock", true); |
| 23 | |
| 24 | public static final ModConfigSpec.IntValue MAGIC_NUMBER = BUILDER |
| 25 | .comment("A magic number") |
| 26 | .defineInRange("magicNumber", 42, 0, Integer.MAX_VALUE); |
| 27 | |
| 28 | public static final ModConfigSpec.ConfigValue<String> MAGIC_NUMBER_INTRODUCTION = BUILDER |
| 29 | .comment("What you want the introduction message to be for the magic number") |
| 30 | .define("magicNumberIntroduction", "The magic number is... "); |
| 31 | |
| 32 | // a list of strings that are treated as resource locations for items |
| 33 | public static final ModConfigSpec.ConfigValue<List<? extends String>> ITEM_STRINGS = BUILDER |
| 34 | .comment("A list of items to log on common setup.") |
| 35 | .defineListAllowEmpty("items", List.of("minecraft:iron_ingot"), () -> "", Config::validateItemName); |
| 36 | |
| 37 | static final ModConfigSpec SPEC = BUILDER.build(); |
| 38 | |
| 39 | private static boolean validateItemName(final Object obj) { |
| 40 | return obj instanceof String itemName && BuiltInRegistries.ITEM.containsKey(ResourceLocation.parse(itemName)); |
| 41 | } |
| 42 | } |
nothing calls this directly
no outgoing calls
no test coverage detected