Jump to content

TheOneWithBlueEyes

Members
  • Posts

    16
  • Joined

  • Last visited

Everything posted by TheOneWithBlueEyes

  1. 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?
  2. AMD Drivers on Windows are known to be really bad... Try clean installing all your drivers by removing them with Display Driver Uninstaller and then download fresh drivers. That's what worked for me the last time I had something like this happen.
  3. package us.blueeyemods.uem; import dev.toma.configuration.Configuration; import dev.toma.configuration.config.format.ConfigFormats; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import us.blueeyemods.uem.config.ModConfig; @SuppressWarnings("unused") @Mod(Main.MODID) public class Main { public static final String MODID = "uem"; public static ModConfig config; public Main() { IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); MinecraftForge.EVENT_BUS.register(this); config = Configuration.registerConfig(ModConfig.class, ConfigFormats.json()).getConfigInstance(); } } I don't understand why this is throwing a null pointer exception when I use this in my mixin: package us.blueeyemods.uem.mixin.mending; import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.item.enchantment.EnchantmentCategory; import net.minecraft.world.item.enchantment.MendingEnchantment; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.ModifyArg; import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; import us.blueeyemods.uem.Main; @Mixin(MendingEnchantment.class) public class MendingMixin { int field_1 = Main.config.mending.MAXIMUM_ENCHANTMENT_LEVEL; boolean field_2 = Main.config.mending.TREASURE_ONLY; private static Enchantment.Rarity field_3 = Main.config.mending.ENCHANTMENT_RARITY; private static EnchantmentCategory field_4 = Main.config.mending.ENCHANTMENT_CATEGORY; private static EquipmentSlot[] field_5 = Main.config.mending.EQUIPMENT_SLOTS; @Inject( method = {"getMaxLevel"}, at = {@At("RETURN")}, cancellable = true ) public void betterenchantments$getMaxLevel(CallbackInfoReturnable<Integer> cir) { cir.setReturnValue(Math.min(field_1, 255)); } @Inject( method = {"isTreasureOnly"}, at = {@At("RETURN")}, cancellable = true ) public void betterenchantments$isTreasureOnly(CallbackInfoReturnable<Boolean> cir) { cir.setReturnValue(field_2); } @ModifyArg( method = {"<init>"}, at = @At( value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/Enchantment;" + "<init>(Lnet/minecraft/world/item/enchantment/Enchantment$Rarity;" + "Lnet/minecraft/world/item/enchantment/EnchantmentCategory;" + "[Lnet/minecraft/world/entity/EquipmentSlot;)V" ), index = 0 ) private static Enchantment.Rarity betterenchantments$modifyEnchantmentRarity(Enchantment.Rarity weight) { return field_3; } @ModifyArg( method = {"<init>"}, at = @At( value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/Enchantment;" + "<init>(Lnet/minecraft/world/item/enchantment/Enchantment$Rarity;" + "Lnet/minecraft/world/item/enchantment/EnchantmentCategory;" + "[Lnet/minecraft/world/entity/EquipmentSlot;)V" ), index = 1 ) private static EnchantmentCategory betterenchantments$modifyEnchantmentCategory(EnchantmentCategory pCategory) { return field_4; } @ModifyArg( method = {"<init>"}, at = @At( value = "INVOKE", target = "Lnet/minecraft/world/item/enchantment/Enchantment;" + "<init>(Lnet/minecraft/world/item/enchantment/Enchantment$Rarity;" + "Lnet/minecraft/world/item/enchantment/EnchantmentCategory;" + "[Lnet/minecraft/world/entity/EquipmentSlot;)V" ), index = 2 ) private static EquipmentSlot[] betterenchantments$modifyEnchantmentSlots(EquipmentSlot[] pApplicableSlots) { return field_5; } } What went wrong?
  4. I'm trying to make it so certain config options don't show up if Apotheosis is loaded, I was just wondering how I would do that.
  5. Sorry for the delayed response, but I got it figured out. Thank you ChampionAsh5357.
  6. @Config(name = Main.MODID + "/mending") public class MendingConfig implements ConfigData { public static int MAX_LVL = 10; public static boolean IS_TREASURE_ONLY = false, IS_TRADEABLE = false; } I'm getting an error saying that it can't find me/shedaniel/autoconfig/ConfigData? I don't have architectury installed into my Dev Environment, could that be the issue? It doesn't explicitly state that you are required to have it.
×
×
  • Create New...

Important Information

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