|
| 1 | +package de.dertoaster.crossbowverhaul.config; |
| 2 | + |
| 3 | +import org.apache.commons.lang3.tuple.Pair; |
| 4 | + |
| 5 | +import net.minecraftforge.common.ForgeConfigSpec; |
| 6 | +import net.minecraftforge.common.ForgeConfigSpec.ConfigValue; |
| 7 | + |
| 8 | +public class CrossbowverhaulConfigHolder { |
| 9 | + |
| 10 | + public static class ItemConfig { |
| 11 | + private static final boolean allowEnchantmentsOnCrossbow = true; |
| 12 | + private static final boolean allowEnchantmentsOnNetheriteCrossbow = true; |
| 13 | + private static final boolean modifyMultiShotEnchantment = true; |
| 14 | + |
| 15 | + public final ConfigValue<Boolean> coEnchCrossbow; |
| 16 | + public final ConfigValue<Boolean> coEnchNetheriteCrossbow; |
| 17 | + public final ConfigValue<Boolean> coModMultishot; |
| 18 | + |
| 19 | + public ItemConfig(ForgeConfigSpec.Builder builder) { |
| 20 | + builder.push("co-item"); |
| 21 | + |
| 22 | + this.coEnchCrossbow = builder |
| 23 | + .comment("Enable enchantments on the crossbow") |
| 24 | + .defineInRange("Enable enchants on crossbow", allowEnchantmentsOnCrossbow, true, false, Boolean.class); |
| 25 | + |
| 26 | + this.coEnchNetheriteCrossbow = builder |
| 27 | + .comment("Enable enchantments on the netherite crossbow") |
| 28 | + .defineInRange("Enable enchants on netherite crossbow", allowEnchantmentsOnNetheriteCrossbow, true, false, Boolean.class); |
| 29 | + |
| 30 | + builder.pop(); |
| 31 | + |
| 32 | + builder.push("co-ench"); |
| 33 | + |
| 34 | + this.coModMultishot = builder |
| 35 | + .comment("Allows multishot to go up to five") |
| 36 | + .defineInRange("Modify multishot enchantment", modifyMultiShotEnchantment, true, false, Boolean.class); |
| 37 | + |
| 38 | + builder.pop(); |
| 39 | + } |
| 40 | + |
| 41 | + } |
| 42 | + |
| 43 | + public static final ItemConfig ITEM_CONFIG; |
| 44 | + public static final ForgeConfigSpec ITEM_CONFIG_SPEC; |
| 45 | + |
| 46 | + static { |
| 47 | + Pair<ItemConfig, ForgeConfigSpec> itemConfigSpecPair = new ForgeConfigSpec.Builder().configure(ItemConfig::new); |
| 48 | + |
| 49 | + ITEM_CONFIG = itemConfigSpecPair.getLeft(); |
| 50 | + ITEM_CONFIG_SPEC = itemConfigSpecPair.getRight(); |
| 51 | + } |
| 52 | + |
| 53 | +} |
0 commit comments