Jump to content

Recommended Posts

Posted
package us.blueeyemods.uem.config;

import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.item.enchantment.Enchantment;
import net.minecraft.world.item.enchantment.EnchantmentCategory;
import net.minecraftforge.common.ForgeConfigSpec;

import java.util.Arrays;
import java.util.List;

public class Config {
    public static final ForgeConfigSpec.Builder BUILDER = new ForgeConfigSpec.Builder();
    public static final ForgeConfigSpec SPEC;

    public static ForgeConfigSpec.EnumValue<Enchantment.Rarity> RARITY_ENUM_0;
    public static ForgeConfigSpec.EnumValue<EnchantmentCategory> CATEGORY_ENUM_0;
    public static ForgeConfigSpec.ConfigValue<List<? extends EquipmentSlot>> SLOTS_LIST_0;
    public static ForgeConfigSpec.ConfigValue<Integer> MAX_LEVEL_INTEGER_0;
    public static ForgeConfigSpec.ConfigValue<Boolean> TREASURE_BOOLEAN_0;
    public static ForgeConfigSpec.ConfigValue<Boolean> DISCOVERABLE_BOOLEAN_0;
    public static ForgeConfigSpec.ConfigValue<Boolean> TRADEABLE_BOOLEAN_0;
    public static ForgeConfigSpec.ConfigValue<Boolean> BOOKS_ALLOWED_BOOLEAN_0;
    public static ForgeConfigSpec.ConfigValue<Boolean> CURSE_BOOLEAN_0;

    public static ForgeConfigSpec.EnumValue<Enchantment.Rarity> RARITY_ENUM_1;
    public static ForgeConfigSpec.EnumValue<EnchantmentCategory> CATEGORY_ENUM_1;
    public static ForgeConfigSpec.ConfigValue<List<? extends EquipmentSlot>> SLOTS_LIST_1;
    public static ForgeConfigSpec.ConfigValue<Integer> MAX_LEVEL_INTEGER_1;
    public static ForgeConfigSpec.ConfigValue<Boolean> TREASURE_BOOLEAN_1;
    public static ForgeConfigSpec.ConfigValue<Boolean> DISCOVERABLE_BOOLEAN_1;
    public static ForgeConfigSpec.ConfigValue<Boolean> TRADEABLE_BOOLEAN_1;
    public static ForgeConfigSpec.ConfigValue<Boolean> BOOKS_ALLOWED_BOOLEAN_1;
    public static ForgeConfigSpec.ConfigValue<Boolean> CURSE_BOOLEAN_1;

    static {
        BUILDER.push("MENDING");

        RARITY_ENUM_0 = BUILDER.defineEnum("rarity", Enchantment.Rarity.RARE);
        CATEGORY_ENUM_0 = BUILDER.defineEnum("category", EnchantmentCategory.BREAKABLE);
        SLOTS_LIST_0 = BUILDER.defineList("slots",
                Arrays.asList(EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.OFFHAND, EquipmentSlot.MAINHAND), entry -> true);
        MAX_LEVEL_INTEGER_0 = BUILDER.defineInRange("maxLvl", 1, 1, 255);
        TREASURE_BOOLEAN_0 = BUILDER.define("isTreasure", true);
        DISCOVERABLE_BOOLEAN_0 = BUILDER.define("discoverable", true);
        TRADEABLE_BOOLEAN_0 = BUILDER.define("tradeable", true);
        BOOKS_ALLOWED_BOOLEAN_0 = BUILDER.define("isAllowedOnBooks", true);
        CURSE_BOOLEAN_0 = BUILDER.define("isCurse", true);

        BUILDER.pop();

        BUILDER.push("UNBREAKING");

        RARITY_ENUM_1 = BUILDER.defineEnum("rarity", Enchantment.Rarity.UNCOMMON);
        CATEGORY_ENUM_1 = BUILDER.defineEnum("category", EnchantmentCategory.BREAKABLE);
        SLOTS_LIST_1 = BUILDER.defineList("slots",
                Arrays.asList(EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.OFFHAND, EquipmentSlot.MAINHAND), entry -> true);
        MAX_LEVEL_INTEGER_1 = BUILDER.defineInRange("maxLvl", 3, 1, 255);
        TREASURE_BOOLEAN_1 = BUILDER.define("isTreasure", false);
        DISCOVERABLE_BOOLEAN_1 = BUILDER.define("discoverable", true);
        TRADEABLE_BOOLEAN_1 = BUILDER.define("tradeable", true);
        BOOKS_ALLOWED_BOOLEAN_1 = BUILDER.define("isAllowedOnBooks", true);
        CURSE_BOOLEAN_1 = BUILDER.define("isCurse", true);

        BUILDER.pop();

        SPEC = BUILDER.build();
    }
}

This works, but it seems to be a mess. How would I clean it up?

New year, new me. Nothing's going to get me down!

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.