Advertisement
Jahus

Untitled

Jun 23rd, 2025
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 1.84 KB | None | 0 0
  1. package net.jahus.neverpenaltyanvil;
  2.  
  3. import net.minecraftforge.common.ForgeConfigSpec;
  4. import net.minecraftforge.eventbus.api.SubscribeEvent;
  5. import net.minecraftforge.fml.event.config.ModConfigEvent;
  6.  
  7. public class ModConfigHandler {
  8.  
  9.     public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
  10.  
  11.     public static final ForgeConfigSpec.BooleanValue enabled = BUILDER
  12.         .comment("Enable or disable the anvil modification")
  13.         .define("enabled", true);
  14.  
  15.     public static final ForgeConfigSpec.BooleanValue useVanillaPenalty = BUILDER
  16.         .comment("Use vanilla formula (true) or linear formula ax + b (false)")
  17.         .define("useVanillaPenalty", true);
  18.  
  19.     public static final ForgeConfigSpec.IntValue linearA = BUILDER
  20.         .comment("Coefficient a for linear formula (used if useVanillaPenalty = false)")
  21.         .defineInRange("linearA", 2, 0, 100);
  22.  
  23.     public static final ForgeConfigSpec.IntValue linearB = BUILDER
  24.         .comment("Constant b for linear formula (used if useVanillaPenalty = false)")
  25.         .defineInRange("linearB", 1, 0, 100);
  26.  
  27.     public static final ForgeConfigSpec.IntValue maxCost = BUILDER
  28.         .comment("Maximum XP cost shown in anvil (set -1 for no cap)")
  29.         .defineInRange("maxCost", -1, -1, 1000);
  30.  
  31.     public static final ForgeConfigSpec.IntValue maxPenalty = BUILDER
  32.         .comment("Maximum penalty stored in NBT (set -1 for no cap)")
  33.         .defineInRange("maxPenalty", -1, -1, 1000);
  34.  
  35.     public static final ForgeConfigSpec.IntValue renameCost = BUILDER
  36.         .comment("XP cost when renaming only (with no second item)")
  37.         .defineInRange("renameCost", 1, 0, 39);
  38.  
  39.     public static final ForgeConfigSpec SPEC = BUILDER.build();
  40.  
  41.     @SubscribeEvent
  42.     public static void onLoad(ModConfigEvent event) {
  43.         // Reserved
  44.     }
  45. }
  46.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement