diff --git a/build.gradle b/build.gradle index e7e48e2..2fa2de0 100644 --- a/build.gradle +++ b/build.gradle @@ -18,7 +18,14 @@ repositories { // for more information about repositories. maven { url 'https://jitpack.io' } maven { url "https://maven.shedaniel.me/" } - maven { url = 'https://maven.terraformersmc.com/releases/' } + maven { + name = "Terraformers" + url = "https://maven.terraformersmc.com/" + } + maven { + name 'Xander Maven' + url 'https://maven.isxander.dev/releases' + } } dependencies { @@ -40,10 +47,7 @@ dependencies { exclude(group: "net.fabricmc.fabric-api") } - modApi("me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}") { - exclude(group: "net.fabricmc.fabric-api") - } - include "me.shedaniel.cloth:cloth-config-fabric:${project.cloth_config_version}" + modImplementation("dev.isxander:yet-another-config-lib:${project.yet_another_config_lib_version}") } loom { diff --git a/changelog.txt b/changelog.txt index ea74cdf..5bcc1cc 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,17 +1,7 @@ -1.3.9-alpha.2-1.20.6 +1.3.9-1.20.6 Fixes/Changes: - Updated to 1.20.5/6 - Updated dependencies - Fixed Compound Enchantments not showing up in enchanting tables even if enabled - -Alpha.2: -- Fixed crash that didn't occur in development environment (#16) - -1.20.5/6 made many drastic changes to how enchantments work in the game resulting in a massive overhaul of many of the mod's systems. Because of this, this release is an alpha and should be considered unstable. -Please report any bugs/crashes. Ideally, make an issue on the mod's Github: https://github.com/Quplet/Qu-Enchantments - -Currently known broken systems: -- Enabling/disabling specific enchantments - -In the future I intend to replace Cloth config with an alternative config library. The full release of 1.3.9 should have this. \ No newline at end of file +- Changed configuration library from Cloth Config to YetAnotherConfigLib \ No newline at end of file diff --git a/generateDefaultOptions.py b/generateDefaultOptions.py index c946b0d..07c5334 100644 --- a/generateDefaultOptions.py +++ b/generateDefaultOptions.py @@ -1,38 +1,70 @@ import sys - def main(): name = sys.argv[1] - fname = format_name(name) + formatted_name = format_name(name) + + with open('desc.txt', 'w') as f: + + f.writelines([ + f' // {formatted_name} options\n', + ' @SerialEntry\n', + f' public boolean {name}Enabled = true;\n', + ' @SerialEntry\n', + f' public boolean {name}RandomSelection = true;\n', + ' @SerialEntry\n', + f' public boolean {name}EnchantingTable = true;\n', + ' @SerialEntry\n', + f' public boolean {name}BookOffer = true;\n\n' + ]) + + f.writelines([ + f' private static final Collection> {name}Options = ImmutableList.of(\n', + ' baseEnabled.binding(\n', + ' true,\n' + f' () -> NewModConfig.CONFIG_HANDLER.instance().{name}Enabled,\n', + f' newVal -> NewModConfig.CONFIG_HANDLER.instance().{name}Enabled = newVal\n', + ' )\n', + ' .build(),\n\n', + + ' baseRandomSelection.binding(\n', + ' true,\n' + f' () -> NewModConfig.CONFIG_HANDLER.instance().{name}RandomSelection,\n', + f' newVal -> NewModConfig.CONFIG_HANDLER.instance().{name}RandomSelection = newVal\n', + ' )\n', + ' .build(),\n\n', - f = open('desc.txt', 'w') + ' baseEnchantingTable.binding(\n', + ' true,\n' + f' () -> NewModConfig.CONFIG_HANDLER.instance().{name}EnchantingTable,\n', + f' newVal -> NewModConfig.CONFIG_HANDLER.instance().{name}EnchantingTable = newVal\n', + ' )\n', + ' .build(),\n\n', - f.writelines([f'"text.autoconfig.qu-enchantments.option.{name}": "{fname}",\n', - f'"text.autoconfig.qu-enchantments.option.{name}.isEnabled": "Is Enabled: ",\n', - f'"text.autoconfig.qu-enchantments.option.{name}.randomSelection": "Spawn As Loot: ",\n', - f'"text.autoconfig.qu-enchantments.option.{name}.enchantingTable": "Available On Enchanting Table: ' - '",\n', - f'"text.autoconfig.qu-enchantments.option.{name}.bookOffer": "Is Tradable: ",\n\n']) - f.writelines([f'public static class {name[0].upper() + name[1:]} {{\n', - '\tpublic boolean isEnabled = true;\n', - '\tpublic boolean randomSelection = true;\n', - '\tpublic boolean enchantingTable = true;\n', - '\tpublic boolean bookOffer = true;\n}\n\n']) - f.writelines(['@ConfigEntry.Gui.CollapsibleObject\n', - f'public static final {name[0].upper() + name[1:]} {name} = new {name[0].upper() + name[1:]}();\n']) + ' baseBookOffer.binding(\n', + ' true,\n' + f' () -> NewModConfig.CONFIG_HANDLER.instance().{name}BookOffer,\n', + f' newVal -> NewModConfig.CONFIG_HANDLER.instance().{name}BookOffer = newVal\n', + ' )\n', + ' .build()\n', + ' );\n\n', - f.close() + f' createOptionsGroup("{name}", {name}Options)\n\n', + + + f'"qu-enchantments.config.{name}.group.title": "{formatted_name} Options",\n', + f'"qu-enchantments.config.{name}.group.desc": "Configuration options for the {formatted_name} Enchantment",\n' + ]) def format_name(name): - string = '' - n = 0 - for i in range(len(name)): - if name[i].isupper(): - string += name[n:i] + ' ' - n = i - string += name[n:] - return string[0].upper() + string[1:] + new_str = '' + + for char in name: + new_str += f' {char}' if char.isupper() else char + + return new_str.title() + if __name__ == '__main__': diff --git a/gradle.properties b/gradle.properties index 4a9e21f..9924daa 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ org.gradle.parallel=true loader_version=0.15.11 # Mod Properties - mod_version = 1.3.9-alpha.2-1.20.6 + mod_version = 1.3.9-1.20.6 maven_group = qu archives_base_name = qu-enchantments @@ -17,4 +17,4 @@ org.gradle.parallel=true fabric_version=0.99.0+1.20.6 mixin_extras_version = 0.3.6 mod_menu_version = 10.0.0-beta.1 - cloth_config_version = 14.0.126 \ No newline at end of file + yet_another_config_lib_version = 3.4.4+1.20.6-fabric \ No newline at end of file diff --git a/readme.md b/readme.md index bad94df..3648637 100644 --- a/readme.md +++ b/readme.md @@ -1,3 +1,5 @@ +![Qu Enchantments Banner](https://i.imgur.com/rkXBNCN.png) + # Qu Enchantments Mod (For Fabric/Quilt) Welcome! This is a mod adding various enchantments that ~~in my opinion~~ add much needed variation to the enchantments @@ -101,5 +103,3 @@ Thanks to [E_Leven](https://www.instagram.com/evan_cdg/) for all the textures I ## 📜 License Copyright 2022 Quplet, Apache License 2.0. Please credit if you use or distribute my work. - -For the web graphics, Copyright 2023 E_Leven, All Rights Reserved. diff --git a/src/client/java/qu/quEnchantments/util/config/ConfigGenerator.java b/src/client/java/qu/quEnchantments/util/config/ConfigGenerator.java new file mode 100644 index 0000000..ae45de7 --- /dev/null +++ b/src/client/java/qu/quEnchantments/util/config/ConfigGenerator.java @@ -0,0 +1,1009 @@ +package qu.quEnchantments.util.config; + +import com.google.common.collect.ImmutableList; +import dev.isxander.yacl3.api.*; +import dev.isxander.yacl3.api.controller.*; +import net.minecraft.text.Text; +import qu.quEnchantments.QuEnchantments; + +import java.util.Collection; +import java.util.function.Consumer; +import java.util.function.Supplier; + +public class ConfigGenerator { + + private static final Option.Builder baseEnabled = Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.general.enabled")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.general.enabled.desc"))) + .controller(TickBoxControllerBuilder::create); + + private static final Option.Builder baseRandomSelection = Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.general.randomSelection")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.general.randomSelection.desc"))) + .controller(TickBoxControllerBuilder::create); + + private static final Option.Builder baseEnchantingTable = Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.general.enchantingTable")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.general.enchantingTable.desc"))) + .controller(TickBoxControllerBuilder::create); + + private static final Option.Builder baseBookOffer = Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.general.bookOffer")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.general.bookOffer.desc"))) + .controller(TickBoxControllerBuilder::create); + + private static final Collection> accuracyOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().accuracyEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().accuracyEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().accuracyRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().accuracyRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().accuracyEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().accuracyEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().accuracyBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().accuracyBookOffer = newVal + ) + .build() + ); + + private static final Collection> aggressionBlessingOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "aggressionBlessing.attackSpeed", + 0.8f, + () -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingAttackSpeed, + newVal -> ModConfig.CONFIG_HANDLER.instance().aggressionBlessingAttackSpeed = newVal, + 0.0f, + 1.0f, + 0.05f + ) + ); + + private static final Collection> agitationCurseOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().agitationCurseEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().agitationCurseEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().agitationCurseRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().agitationCurseRandomSelection = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().agitationCurseBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().agitationCurseBookOffer = newVal + ) + .build(), + + createDoubleSliderOption( + "agitationCurse.radius", + 16.0, + () -> ModConfig.CONFIG_HANDLER.instance().agitationCurseRadius, + newVal -> ModConfig.CONFIG_HANDLER.instance().agitationCurseRadius = newVal, + 0.0, + 64.0, + 0.25 + ) + ); + + private static final Collection> arrowsFlightOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "arrowsFlight.arrowSpeed", + 1.0f, + () -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightArrowSpeed, + newVal -> ModConfig.CONFIG_HANDLER.instance().arrowsFlightArrowSpeed = newVal, + 0.0f, + 10.0f, + 0.1f + ) + ); + + private static final Collection> bashingOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().bashingEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().bashingEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().bashingRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().bashingRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().bashingEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().bashingEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().bashingBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().bashingBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "bashing.knockbackStrength", + 0.6f, + () -> ModConfig.CONFIG_HANDLER.instance().bashingKnockbackStrength, + newVal -> ModConfig.CONFIG_HANDLER.instance().bashingKnockbackStrength = newVal, + 0.0f, + 10.0f, + 0.1f + ) + ); + + private static final Collection> essenceOfEnderOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderBookOffer = newVal + ) + .build(), + + createDoubleSliderOption( + "essenceOfEnder.teleportDistance", + 5.0, + () -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderTeleportDistance, + newVal -> ModConfig.CONFIG_HANDLER.instance().essenceOfEnderTeleportDistance = newVal, + 2.0, + 8.0, + 0.25 + ) + ); + + private static final Collection> fidelityOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().fidelityEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().fidelityEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().fidelityRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().fidelityRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().fidelityEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().fidelityEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().fidelityBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().fidelityBookOffer = newVal + ) + .build() + ); + + private static final Collection> freezingAspectOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().freezingAspectEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().freezingAspectEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().freezingAspectRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().freezingAspectRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().freezingAspectEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().freezingAspectEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().freezingAspectBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().freezingAspectBookOffer = newVal + ) + .build(), + + createIntegerSliderOption( + "freezingAspect.duration", + 75, + () -> ModConfig.CONFIG_HANDLER.instance().freezingAspectDuration, + newVal -> ModConfig.CONFIG_HANDLER.instance().freezingAspectDuration = newVal, + 0, + 500, + 5 + ) + ); + + private static final Collection> inaneAspectOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().inaneAspectEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().inaneAspectEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().inaneAspectRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().inaneAspectRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().inaneAspectEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().inaneAspectEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().inaneAspectBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().inaneAspectBookOffer = newVal + ) + .build(), + + createIntegerSliderOption( + "inaneAspect.duration", + 40, + () -> ModConfig.CONFIG_HANDLER.instance().inaneAspectDuration, + newVal -> ModConfig.CONFIG_HANDLER.instance().inaneAspectDuration = newVal, + 0, + 500, + 5 + ) + ); + + private static final Collection> leechingAspectOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().leechingAspectEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().leechingAspectEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().leechingAspectRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().leechingAspectRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().leechingAspectEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().leechingAspectEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().leechingAspectBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().leechingAspectBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "leechingAspect.healing", + 0.25f, + () -> ModConfig.CONFIG_HANDLER.instance().leechingAspectHealing, + newVal -> ModConfig.CONFIG_HANDLER.instance().leechingAspectHealing = newVal, + 0.0f, + 20.0f, + 0.25f + ) + ); + + private static final Collection> lightningBoundOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().lightningBoundEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().lightningBoundEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().lightningBoundRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().lightningBoundRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().lightningBoundEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().lightningBoundEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().lightningBoundBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().lightningBoundBookOffer = newVal + ) + .build() + ); + + private static final Collection> luckyMinerOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().luckyMinerEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().luckyMinerEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().luckyMinerRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().luckyMinerRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().luckyMinerEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().luckyMinerEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().luckyMinerBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().luckyMinerBookOffer = newVal + ) + .build() + ); + + private static final Collection> moltenWalkerOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerBookOffer = newVal + ) + .build(), + + createIntegerSliderOption( + "moltenWalker.radius", + 2, + () -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerRadius, + newVal -> ModConfig.CONFIG_HANDLER.instance().moltenWalkerRadius = newVal, + 0, + 16, + 1 + ) + ); + + private static final Collection> nightbloodOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodBookOffer = newVal + ) + .build(), + + createBooleanOption( + "nightblood.disablesExperience", + true, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodDisablesExperience, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodDisablesExperience = newVal + ), + + createIntegerSliderOption( + "nightblood.witherDuration", + 200, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodWitherDuration, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodWitherDuration = newVal, + 0, + 1000, + 5 + ), + + createIntegerSliderOption( + "nightblood.witherAmplifier", + 1, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodWitherAmplifier, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodWitherAmplifier = newVal, + 1, + 127, + 1 + ), + + createFloatSliderOption( + "nightblood.drainRate", + 1.0f, + () -> ModConfig.CONFIG_HANDLER.instance().nightbloodDrainRate, + newVal -> ModConfig.CONFIG_HANDLER.instance().nightbloodDrainRate = newVal, + 0.0f, + 10.0f, + 0.25f + ) + ); + + private static final Collection> omenOfImmunityOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityBookOffer = newVal + ) + .build(), + + createBooleanOption( + "omenOfImmunity.breakOnNoDurability", + true, + () -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityBreakOnNoDurability, + newVal -> ModConfig.CONFIG_HANDLER.instance().omenOfImmunityBreakOnNoDurability = newVal + ) + ); + + private static final Collection> reflectionOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().reflectionEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().reflectionEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().reflectionRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().reflectionRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().reflectionEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().reflectionEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().reflectionBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().reflectionBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "reflection.divergence", + 1.0f, + () -> ModConfig.CONFIG_HANDLER.instance().reflectionDivergence, + newVal -> ModConfig.CONFIG_HANDLER.instance().reflectionDivergence = newVal, + 0.0f, + 5.0f, + 0.1f + ) + ); + + private static final Collection> regenerationBlessingOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().regenerationBlessingBookOffer = newVal + ) + .build() + ); + + private static final Collection> shapedGlassOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "shapedGlass.damageMultiplier", + 2.0f, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassDamageMultiplier, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassDamageMultiplier = newVal, + 0.0f, + 20.0f, + 0.25f + ), + + createIntegerSliderOption( + "shapedGlass.itemDamage", + 20, + () -> ModConfig.CONFIG_HANDLER.instance().shapedGlassItemDamage, + newVal -> ModConfig.CONFIG_HANDLER.instance().shapedGlassItemDamage = newVal, + 0, + 1000, + 1 + ) + ); + + private static final Collection> skywalkerOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerBookOffer = newVal + ) + .build(), + + createIntegerSliderOption( + "skywalker.radius", + 0, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerRadius, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerRadius = newVal, + 0, + 16, + 1 + ), + + createIntegerSliderOption( + "skywalker.cloudDuration", + 25, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerCloudDuration, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerCloudDuration = newVal, + 0, + 1000, + 5 + ), + + createBooleanOption( + "skywalker.halfUltrawarmDuration", + true, + () -> ModConfig.CONFIG_HANDLER.instance().skywalkerHalfUltrawarmDuration, + newVal -> ModConfig.CONFIG_HANDLER.instance().skywalkerHalfUltrawarmDuration = newVal + ) + ); + + private static final Collection> speedBlessingOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().speedBlessingEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().speedBlessingEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().speedBlessingRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().speedBlessingRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().speedBlessingEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().speedBlessingEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().speedBlessingBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().speedBlessingBookOffer = newVal + ) + .build(), + + createFloatSliderOption( + "speedBlessing.speedBoost", + 0.2f, + () -> ModConfig.CONFIG_HANDLER.instance().speedBlessingSpeedBoost, + newVal -> ModConfig.CONFIG_HANDLER.instance().speedBlessingSpeedBoost = newVal, + 0.0f, + 10.0f, + 0.1f + ) + ); + + private static final Collection> stripMinerOptions = ImmutableList.of( + baseEnabled.binding( + true, + () -> ModConfig.CONFIG_HANDLER.instance().stripMinerEnabled, + newVal -> ModConfig.CONFIG_HANDLER.instance().stripMinerEnabled = newVal + ) + .build(), + + baseRandomSelection.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().stripMinerRandomSelection, + newVal -> ModConfig.CONFIG_HANDLER.instance().stripMinerRandomSelection = newVal + ) + .build(), + + baseEnchantingTable.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().stripMinerEnchantingTable, + newVal -> ModConfig.CONFIG_HANDLER.instance().stripMinerEnchantingTable = newVal + ) + .build(), + + baseBookOffer.binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().stripMinerBookOffer, + newVal -> ModConfig.CONFIG_HANDLER.instance().stripMinerBookOffer = newVal + ) + .build(), + + createIntegerSliderOption( + "stripMiner.radius", + 1, + () -> ModConfig.CONFIG_HANDLER.instance().stripMinerRadius, + newVal -> ModConfig.CONFIG_HANDLER.instance().stripMinerRadius = newVal, + 0, + 16, + 1 + ) + ); + + private static final Collection optionGroups = ImmutableList.of( + createOptionsGroup("accuracy", accuracyOptions), + createOptionsGroup("aggressionBlessing", aggressionBlessingOptions), + createOptionsGroup("agitationCurse", agitationCurseOptions), + createOptionsGroup("arrowsFlight", arrowsFlightOptions), + createOptionsGroup("bashing", bashingOptions), + createOptionsGroup("essenceOfEnder", essenceOfEnderOptions), + createOptionsGroup("fidelity", fidelityOptions), + createOptionsGroup("freezingAspect", freezingAspectOptions), + createOptionsGroup("inaneAspect", inaneAspectOptions), + createOptionsGroup("leechingAspect", leechingAspectOptions), + createOptionsGroup("lightningBound", lightningBoundOptions), + createOptionsGroup("luckyMiner", lightningBoundOptions), + createOptionsGroup("moltenWalker", moltenWalkerOptions), + createOptionsGroup("nightblood", nightbloodOptions), + createOptionsGroup("omenOfImmunity", omenOfImmunityOptions), + createOptionsGroup("reflection", reflectionOptions), + createOptionsGroup("regenerationBlessing", regenerationBlessingOptions), + createOptionsGroup("shapedGlass", shapedGlassOptions), + createOptionsGroup("skywalker", skywalkerOptions), + createOptionsGroup("speedBlessing", speedBlessingOptions), + createOptionsGroup("stripMiner", stripMinerOptions) + ); + + public static YetAnotherConfigLib generateConfig() { + return YetAnotherConfigLib.createBuilder() + .title(Text.translatable(QuEnchantments.MOD_ID + ".config.title")) + .category(ConfigCategory.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.category.enchantments")) + .groups(optionGroups) + .build()) + .category(ConfigCategory.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.category.items")) + .group(OptionGroup.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.rune.group.title")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.rune.group.desc"))) + .option(Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config.rune.breakOnNoDurability")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config.rune.breakOnNoDurability.desc"))) + .binding( + false, + () -> ModConfig.CONFIG_HANDLER.instance().runeBreakOnNoDurability, + newVal -> ModConfig.CONFIG_HANDLER.instance().runeBreakOnNoDurability = newVal + ) + .controller(TickBoxControllerBuilder::create) + .build()) + .build()) + .build()) + .save(() -> ModConfig.CONFIG_HANDLER.save()) + .build(); + } + + private static Option createBooleanOption(String name, boolean def, Supplier getter, Consumer setter) { + return Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config." + name)) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".desc"))) + .controller(TickBoxControllerBuilder::create) + .binding(def, getter, setter) + .build(); + } + + private static Option createFloatSliderOption( + String name, + float def, + Supplier getter, + Consumer setter, + float min, + float max, + float step + ) { + return Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config." + name)) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".desc"))) + .controller(opt -> FloatSliderControllerBuilder.create(opt) + .range(min, max) + .step(step) + .formatValue(value -> Text.literal("" + value))) + .binding( + def, + getter, + setter + ) + .build(); + } + + private static Option createIntegerSliderOption( + String name, + int def, + Supplier getter, + Consumer setter, + int min, + int max, + int step + ) { + return Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config." + name)) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".desc"))) + .controller(opt -> IntegerSliderControllerBuilder.create(opt) + .range(min, max) + .step(step) + .formatValue(value -> Text.literal("" + value))) + .binding( + def, + getter, + setter + ) + .build(); + } + + private static Option createDoubleSliderOption( + String name, + double def, + Supplier getter, + Consumer setter, + double min, + double max, + double step + ) { + return Option.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config." + name)) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".desc"))) + .controller(opt -> DoubleSliderControllerBuilder.create(opt) + .range(min, max) + .step(step) + .formatValue(value -> Text.literal("" + value))) + .binding( + def, + getter, + setter + ) + .build(); + } + + private static OptionGroup createOptionsGroup(String name, Collection> options) { + return OptionGroup.createBuilder() + .name(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".group.title")) + .description(OptionDescription.of(Text.translatable(QuEnchantments.MOD_ID + ".config." + name + ".group.desc"))) + .options(options) + .build(); + } +} diff --git a/src/client/java/qu/quEnchantments/util/config/ModMenuIntegration.java b/src/client/java/qu/quEnchantments/util/config/ModMenuIntegration.java index 24d481d..5d8028a 100644 --- a/src/client/java/qu/quEnchantments/util/config/ModMenuIntegration.java +++ b/src/client/java/qu/quEnchantments/util/config/ModMenuIntegration.java @@ -2,7 +2,6 @@ import com.terraformersmc.modmenu.api.ConfigScreenFactory; import com.terraformersmc.modmenu.api.ModMenuApi; -import me.shedaniel.autoconfig.AutoConfig; import qu.quEnchantments.QuEnchantments; public class ModMenuIntegration implements ModMenuApi { @@ -10,6 +9,6 @@ public class ModMenuIntegration implements ModMenuApi { @Override public ConfigScreenFactory getModConfigScreenFactory() { QuEnchantments.LOGGER.info("Registered ModConfig Screen for " + QuEnchantments.MOD_ID); - return parent -> AutoConfig.getConfigScreen(ModConfig.class, parent).get(); + return parent -> ConfigGenerator.generateConfig().generateScreen(parent); } } diff --git a/src/main/java/qu/quEnchantments/QuEnchantments.java b/src/main/java/qu/quEnchantments/QuEnchantments.java index a1b621a..84c68d3 100644 --- a/src/main/java/qu/quEnchantments/QuEnchantments.java +++ b/src/main/java/qu/quEnchantments/QuEnchantments.java @@ -1,7 +1,5 @@ package qu.quEnchantments; -import me.shedaniel.autoconfig.AutoConfig; -import me.shedaniel.autoconfig.serializer.Toml4jConfigSerializer; import net.fabricmc.api.ModInitializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -12,7 +10,6 @@ import qu.quEnchantments.util.ModEvents; import qu.quEnchantments.util.ModLootTableModifier; import qu.quEnchantments.util.ModTradeRegistry; -import qu.quEnchantments.util.config.ModConfig; /** * @@ -21,13 +18,9 @@ public class QuEnchantments implements ModInitializer { public static final String MOD_ID = "qu-enchantments"; public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); - private static ModConfig config; @Override public void onInitialize() { - AutoConfig.register(ModConfig.class, Toml4jConfigSerializer::new); - config = AutoConfig.getConfigHolder(ModConfig.class).getConfig(); - ModEnchantments.registerModEnchantments(); ModBlocks.registerModBlocks(); ModItems.initializeModItems(); @@ -38,8 +31,4 @@ public void onInitialize() { LOGGER.info("Finished Initializing " + MOD_ID); } - - public static ModConfig getConfig() { - return config; - } } diff --git a/src/main/java/qu/quEnchantments/enchantments/CorruptedEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/CorruptedEnchantment.java index 7654d95..318b7b7 100644 --- a/src/main/java/qu/quEnchantments/enchantments/CorruptedEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/CorruptedEnchantment.java @@ -113,52 +113,11 @@ public static void corruptEnchantments(ItemStack stack) { newMap.put(corruptedEnchantment, newLevel); EnchantmentHelper.apply(stack, components -> { - components.remove(e -> !newMap.containsKey(e)); + components.remove(e -> !newMap.containsKey((Enchantment) e)); for (Object2IntMap.Entry entry : newMap.object2IntEntrySet()) { components.set(entry.getKey(), entry.getIntValue()); } }); - - - -// if (stack == null || -// (!stack.hasEnchantments() && !stack.isOf(Items.ENCHANTED_BOOK)) || -// !((IItemStack)(Object)stack).isEnchantmentsDirty()) return; -// -// Map enchantments = EnchantmentHelper.get(stack); -// CorruptedEnchantment corruptedEnchantment = null; -// int cLevel = 0; -// -// for (Map.Entry entry : enchantments.entrySet()) { -// if (entry.getKey() instanceof CorruptedEnchantment) { -// corruptedEnchantment = (CorruptedEnchantment) entry.getKey(); -// cLevel = entry.getValue(); -// break; -// } -// } -// ((IItemStack)(Object)stack).setEnchantmentsDirty(false); -// if (corruptedEnchantment == null) return; -// -// int levels = 0; -// Set newSet = Set.copyOf(enchantments.keySet()); -// -// for (Enchantment enchantment : newSet) { -// Optional> key; -// Optional> entry; -// if (enchantment.isCursed() || (key = Registries.ENCHANTMENT.getKey(enchantment)).isPresent() && -// (entry = Registries.ENCHANTMENT.getEntry(key.get())).isPresent() && -// entry.get().isIn(corruptedEnchantment.enchantmentType.corruptible)) { -// int level = enchantments.remove(enchantment); -// if (enchantment instanceof CompoundEnchantment) level /= 5; -// levels += level; -// } -// } -// -// if (levels == cLevel) levels++; -// levels = Math.min(Math.max(cLevel, levels), corruptedEnchantment.getMaxLevel()); -// enchantments.put(corruptedEnchantment, levels); -// if (stack.isOf(Items.ENCHANTED_BOOK)) stack.removeSubNbt(EnchantedBookItem.STORED_ENCHANTMENTS_KEY); -// EnchantmentHelper.set(enchantments, stack); } /** diff --git a/src/main/java/qu/quEnchantments/enchantments/ModEnchantments.java b/src/main/java/qu/quEnchantments/enchantments/ModEnchantments.java index e776715..32d6797 100644 --- a/src/main/java/qu/quEnchantments/enchantments/ModEnchantments.java +++ b/src/main/java/qu/quEnchantments/enchantments/ModEnchantments.java @@ -19,37 +19,41 @@ import qu.quEnchantments.enchantments.tool.StripMinerEnchantment; import qu.quEnchantments.enchantments.weapon.*; import qu.quEnchantments.util.ModTags; +import qu.quEnchantments.util.config.ModConfig; public class ModEnchantments { + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); + private static final EquipmentSlot[] ALL_ARMOR = new EquipmentSlot[]{EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.LEGS, EquipmentSlot.FEET}; - public static final QuEnchantment FREEZING_ASPECT = register("freezing_aspect", new FreezingAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, 2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); - public static final QuEnchantment LEECHING_ASPECT = register("leeching_aspect", new LeechingAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, 2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); - public static final QuEnchantment INANE_ASPECT = register("inane_aspect", new InaneAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, 2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); - public static final QuEnchantment MOLTEN_WALKER = register("molten_walker", new MoltenWalkerEnchantment(Enchantment.properties(ItemTags.FOOT_ARMOR_ENCHANTABLE, 2, 2, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(25, 10), 4, EquipmentSlot.FEET))); - public static final QuEnchantment BASHING = register("bashing", new BashingEnchantment(Enchantment.properties(ModTags.SHIELD_ENCHANTABLE, 2, 3, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment REFLECTION = register("reflection", new ReflectionEnchantment(Enchantment.properties(ModTags.SHIELD_ENCHANTABLE, 2, 3, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment ACCURACY = register("accuracy", new AccuracyEnchantment(Enchantment.properties(ItemTags.CROSSBOW_ENCHANTABLE, 2, 2, Enchantment.leveledCost(12, 20), Enchantment.constantCost(50), 2, EquipmentSlot.MAINHAND))); - public static final QuEnchantment ARROWS_FLIGHT = register("arrows_flight", new ArrowsFlightEnchantment(Enchantment.properties(ItemTags.BOW_ENCHANTABLE, 2, 2, Enchantment.leveledCost(12, 20), Enchantment.constantCost(50), 2, EquipmentSlot.MAINHAND))); - public static final QuEnchantment SPEED_BLESSING = register("speed_blessing", new SpeedBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, 1, Enchantment.constantCost(5), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment REGENERATION_BLESSING = register("regeneration_blessing", new RegenerationBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, 1, Enchantment.constantCost(5), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment AGGRESSION_BLESSING = register("aggression_blessing", new AggressionBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, 1, Enchantment.constantCost(15), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment FIDELITY = register("fidelity", new FidelityEnchantment(Enchantment.properties(ModTags.HORSE_ARMOR_ENCHANTABLE, 10, 1, Enchantment.constantCost(20), Enchantment.constantCost(50), 8, EquipmentSlot.CHEST))); + public static final QuEnchantment FREEZING_ASPECT = register("freezing_aspect", new FreezingAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, CONFIG.freezingAspectEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); + public static final QuEnchantment LEECHING_ASPECT = register("leeching_aspect", new LeechingAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, CONFIG.leechingAspectEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); + public static final QuEnchantment INANE_ASPECT = register("inane_aspect", new InaneAspectEnchantment(Enchantment.properties(ItemTags.FIRE_ASPECT_ENCHANTABLE, 2, CONFIG.inaneAspectEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND))); + public static final QuEnchantment MOLTEN_WALKER = register("molten_walker", new MoltenWalkerEnchantment(Enchantment.properties(ItemTags.FOOT_ARMOR_ENCHANTABLE, 2, CONFIG.moltenWalkerEnabled ? 2 : 0, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(25, 10), 4, EquipmentSlot.FEET))); + public static final QuEnchantment BASHING = register("bashing", new BashingEnchantment(Enchantment.properties(ModTags.SHIELD_ENCHANTABLE, 2, CONFIG.bashingEnabled ? 1 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment REFLECTION = register("reflection", new ReflectionEnchantment(Enchantment.properties(ModTags.SHIELD_ENCHANTABLE, 2, CONFIG.reflectionEnabled ? 3 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 4, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment ACCURACY = register("accuracy", new AccuracyEnchantment(Enchantment.properties(ItemTags.CROSSBOW_ENCHANTABLE, 2, CONFIG.accuracyEnabled ? 2 : 0, Enchantment.leveledCost(12, 20), Enchantment.constantCost(50), 2, EquipmentSlot.MAINHAND))); + public static final QuEnchantment ARROWS_FLIGHT = register("arrows_flight", new ArrowsFlightEnchantment(Enchantment.properties(ItemTags.BOW_ENCHANTABLE, 2, CONFIG.arrowsFlightEnabled ? 2 : 0, Enchantment.leveledCost(12, 20), Enchantment.constantCost(50), 2, EquipmentSlot.MAINHAND))); + public static final QuEnchantment SPEED_BLESSING = register("speed_blessing", new SpeedBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, CONFIG.speedBlessingEnabled ? 1 : 0, Enchantment.constantCost(5), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment REGENERATION_BLESSING = register("regeneration_blessing", new RegenerationBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, CONFIG.regenerationBlessingEnabled ? 1 : 0, Enchantment.constantCost(5), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment AGGRESSION_BLESSING = register("aggression_blessing", new AggressionBlessingEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 5, CONFIG.aggressionBlessingEnabled ? 1 : 0, Enchantment.constantCost(15), Enchantment.constantCost(50), 8, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment FIDELITY = register("fidelity", new FidelityEnchantment(Enchantment.properties(ModTags.HORSE_ARMOR_ENCHANTABLE, 10, CONFIG.fidelityEnabled ? 1 : 0, Enchantment.constantCost(20), Enchantment.constantCost(50), 8, EquipmentSlot.CHEST))); // Corrupted Enchantments - public static final QuEnchantment SHAPED_GLASS = register("shaped_glass", new ShapedGlassEnchantment(Enchantment.properties(ItemTags.SHARP_WEAPON_ENCHANTABLE, 1, 5, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(30, 10), 2, EquipmentSlot.MAINHAND))); - public static final QuEnchantment NIGHTBLOOD = register("nightblood", new NightbloodEnchantment(Enchantment.properties(ItemTags.SWORD_ENCHANTABLE, 1, 2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment SKYWALKER = register("skywalker", new SkywalkerEnchantment(Enchantment.properties(ItemTags.FOOT_ARMOR_ENCHANTABLE, 1, 2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.FEET))); - public static final QuEnchantment ESSENCE_OF_ENDER = register("essence_of_ender", new EssenceOfEnderEnchantment(Enchantment.properties(ItemTags.ARMOR_ENCHANTABLE, 1, 3, Enchantment.leveledCost(10, 15), Enchantment.leveledCost(40, 15), 2, ALL_ARMOR))); - public static final QuEnchantment OMEN_OF_IMMUNITY = register("omen_of_immunity", new OmenOfImmunityEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 1, 5, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(30, 10), 2, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); - public static final QuEnchantment STRIP_MINER = register("strip_miner", new StripMinerEnchantment(Enchantment.properties(ItemTags.MINING_ENCHANTABLE, 1 ,2, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.MAINHAND))); + public static final QuEnchantment SHAPED_GLASS = register("shaped_glass", new ShapedGlassEnchantment(Enchantment.properties(ItemTags.SHARP_WEAPON_ENCHANTABLE, 1, CONFIG.shapedGlassEnabled ? 5 : 0, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(30, 10), 2, EquipmentSlot.MAINHAND))); + public static final QuEnchantment NIGHTBLOOD = register("nightblood", new NightbloodEnchantment(Enchantment.properties(ItemTags.SWORD_ENCHANTABLE, 1, CONFIG.nightbloodEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment SKYWALKER = register("skywalker", new SkywalkerEnchantment(Enchantment.properties(ItemTags.FOOT_ARMOR_ENCHANTABLE, 1, CONFIG.skywalkerEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.FEET))); + public static final QuEnchantment ESSENCE_OF_ENDER = register("essence_of_ender", new EssenceOfEnderEnchantment(Enchantment.properties(ItemTags.ARMOR_ENCHANTABLE, 1, CONFIG.essenceOfEnderEnabled ? 3 : 0, Enchantment.leveledCost(10, 15), Enchantment.leveledCost(40, 15), 2, ALL_ARMOR))); + public static final QuEnchantment OMEN_OF_IMMUNITY = register("omen_of_immunity", new OmenOfImmunityEnchantment(Enchantment.properties(ModTags.RUNE_ENCHANTABLE, 1, CONFIG.omenOfImmunityEnabled ? 5 : 0, Enchantment.leveledCost(10, 10), Enchantment.leveledCost(30, 10), 2, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND))); + public static final QuEnchantment STRIP_MINER = register("strip_miner", new StripMinerEnchantment(Enchantment.properties(ItemTags.MINING_ENCHANTABLE, 1 ,CONFIG.stripMinerEnabled ? 2 : 0, Enchantment.leveledCost(10, 20), Enchantment.leveledCost(60, 20), 5, EquipmentSlot.MAINHAND))); - public static final QuEnchantment AGITATION_CURSE = register("agitation_curse", new AgitationCurseEnchantment(Enchantment.properties(ItemTags.ARMOR_ENCHANTABLE, 1, 1, Enchantment.constantCost(25), Enchantment.constantCost(50), 8, ALL_ARMOR))); + // Curses + public static final QuEnchantment AGITATION_CURSE = register("agitation_curse", new AgitationCurseEnchantment(Enchantment.properties(ItemTags.ARMOR_ENCHANTABLE, 1, CONFIG.agitationCurseEnabled ? 1 : 0, Enchantment.constantCost(25), Enchantment.constantCost(50), 8, ALL_ARMOR))); // Compound Enchantments - public static final QuEnchantment LUCKY_MINER = register("lucky_miner", new LuckyMinerEnchantment(Enchantment.properties(ItemTags.MINING_ENCHANTABLE, 2, 100, Enchantment.leveledCost(1, 1), Enchantment.leveledCost(5, 1), 1, EquipmentSlot.MAINHAND))); - public static final QuEnchantment LIGHTNING_BOUND = register("lightning_bound", new LightningBoundEnchantment(Enchantment.properties(ItemTags.SHARP_WEAPON_ENCHANTABLE, 2, 100, Enchantment.leveledCost(1, 1), Enchantment.leveledCost(5, 1), 1, EquipmentSlot.MAINHAND))); + public static final QuEnchantment LUCKY_MINER = register("lucky_miner", new LuckyMinerEnchantment(Enchantment.properties(ItemTags.MINING_ENCHANTABLE, 2, CONFIG.luckyMinerEnabled ? 100 : 0, Enchantment.leveledCost(1, 1), Enchantment.leveledCost(5, 1), 1, EquipmentSlot.MAINHAND))); + public static final QuEnchantment LIGHTNING_BOUND = register("lightning_bound", new LightningBoundEnchantment(Enchantment.properties(ItemTags.SHARP_WEAPON_ENCHANTABLE, 2, CONFIG.lightningBoundEnabled ? 100 : 0, Enchantment.leveledCost(1, 1), Enchantment.leveledCost(5, 1), 1, EquipmentSlot.MAINHAND))); public static final ImmutableList QU_ENCHANTMENTS = ImmutableList.of(FREEZING_ASPECT, LEECHING_ASPECT, INANE_ASPECT, MOLTEN_WALKER, BASHING, REFLECTION, ACCURACY, ARROWS_FLIGHT, SPEED_BLESSING, REGENERATION_BLESSING, diff --git a/src/main/java/qu/quEnchantments/enchantments/armor/AgitationCurseEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/armor/AgitationCurseEnchantment.java index 534bc22..c8e31a3 100644 --- a/src/main/java/qu/quEnchantments/enchantments/armor/AgitationCurseEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/armor/AgitationCurseEnchantment.java @@ -6,7 +6,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; @@ -14,7 +13,7 @@ public class AgitationCurseEnchantment extends QuEnchantment { - private static final ModConfig.AgitationCurseOptions CONFIG = QuEnchantments.getConfig().agitationCurseOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public AgitationCurseEnchantment(Properties properties) { super(properties); @@ -30,19 +29,14 @@ public boolean isCursed() { return true; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 1 : 0; -// } - @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.agitationCurseBookOffer; } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.agitationCurseRandomSelection; } @Override @@ -59,7 +53,7 @@ public void tickWhileEquipped(LivingEntity livingEntity, ItemStack stack, int le List mobs = world.getOtherEntities( livingEntity, - livingEntity.getBoundingBox().expand(CONFIG.radius), + livingEntity.getBoundingBox().expand(CONFIG.agitationCurseRadius), entity -> entity.isAlive() && !entity.isTeammate(livingEntity) && entity instanceof MobEntity ); diff --git a/src/main/java/qu/quEnchantments/enchantments/armor/EssenceOfEnderEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/armor/EssenceOfEnderEnchantment.java index 52cc078..0d596d8 100644 --- a/src/main/java/qu/quEnchantments/enchantments/armor/EssenceOfEnderEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/armor/EssenceOfEnderEnchantment.java @@ -14,13 +14,12 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.util.config.ModConfig; public class EssenceOfEnderEnchantment extends CorruptedEnchantment { - private static final ModConfig.EssenceOfEnderOptions CONFIG = QuEnchantments.getConfig().essenceOfEnderOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public EssenceOfEnderEnchantment(Properties properties) { super(EnchantmentType.THORNS, properties); @@ -28,22 +27,17 @@ public EssenceOfEnderEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.essenceOfEnderRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.essenceOfEnderBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 3 : 0; -// } - @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.essenceOfEnderEnchantingTable; } @Override @@ -59,9 +53,9 @@ public void onUserDamaged(LivingEntity user, Entity attacker, int level) { if (user.getWorld().isClient || !(attacker instanceof LivingEntity livingEntity) || (attacker instanceof PlayerEntity player && player.getAbilities().creativeMode)) return; for (int i = 0; i < 7; i++) { - double d = attacker.getX() + (user.getRandom().nextDouble() * clampEither(-0.5, 0.5, attacker.getX() - user.getX())) * CONFIG.entityTeleportDistance * level; - double e = attacker.getY() + (double) (user.getRandom().nextInt(CONFIG.entityTeleportDistance * 2 * level) - (CONFIG.entityTeleportDistance * level)); - double f = attacker.getZ() + (user.getRandom().nextDouble() * clampEither(-0.5, 0.5, attacker.getZ() - user.getZ())) * CONFIG.entityTeleportDistance * level; + double d = attacker.getX() + (user.getRandom().nextDouble() * clampEither(-0.5, 0.5, attacker.getX() - user.getX())) * CONFIG.essenceOfEnderTeleportDistance * level; + double e = attacker.getY() + Math.round(user.getRandom().nextDouble() * CONFIG.essenceOfEnderTeleportDistance * 2 * level - (CONFIG.essenceOfEnderTeleportDistance * level)); + double f = attacker.getZ() + (user.getRandom().nextDouble() * clampEither(-0.5, 0.5, attacker.getZ() - user.getZ())) * CONFIG.essenceOfEnderTeleportDistance * level; if (teleportTo(livingEntity, d, e, f)) break; } } @@ -80,7 +74,7 @@ public void tickWhileEquipped(LivingEntity entity, ItemStack stack, int level) { double d = entity.getX() + (entity.getRandom().nextDouble() - 0.5) * 16.0; double e = entity.getY() + (double) (entity.getRandom().nextInt(32) - 16); double f = entity.getZ() + (entity.getRandom().nextDouble() - 0.5) * 16.0; - if (EssenceOfEnderEnchantment.teleportTo(entity, d, e, f)) break; + if (teleportTo(entity, d, e, f)) break; } entity.damage(world.getDamageSources().magic(), 1); } @@ -94,7 +88,7 @@ private static double clampEither(double min, double max, double value) { } // Functionally equivalent to the Enderman's teleport - public static boolean teleportTo(LivingEntity subject, double x, double y, double z) { + private static boolean teleportTo(LivingEntity subject, double x, double y, double z) { BlockPos.Mutable mutable = new BlockPos.Mutable(x, y, z); while (mutable.getY() > subject.getWorld().getBottomY() && !subject.getWorld().getBlockState(mutable).blocksMovement()) { mutable.move(Direction.DOWN); diff --git a/src/main/java/qu/quEnchantments/enchantments/armor/FidelityEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/armor/FidelityEnchantment.java index 30cf90d..a49df24 100644 --- a/src/main/java/qu/quEnchantments/enchantments/armor/FidelityEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/armor/FidelityEnchantment.java @@ -1,12 +1,11 @@ package qu.quEnchantments.enchantments.armor; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class FidelityEnchantment extends QuEnchantment { - private static final ModConfig.FidelityOptions CONFIG = QuEnchantments.getConfig().fidelityOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public FidelityEnchantment(Properties properties) { super(properties); @@ -14,19 +13,14 @@ public FidelityEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.fidelityRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.fidelityBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 1 : 0; -// } - @Override public boolean isTreasure() { return true; @@ -34,6 +28,6 @@ public boolean isTreasure() { @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.fidelityEnchantingTable; } } diff --git a/src/main/java/qu/quEnchantments/enchantments/armor/MoltenWalkerEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/armor/MoltenWalkerEnchantment.java index d85d3a0..6cc2d60 100644 --- a/src/main/java/qu/quEnchantments/enchantments/armor/MoltenWalkerEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/armor/MoltenWalkerEnchantment.java @@ -12,7 +12,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.blocks.ModBlocks; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; @@ -20,7 +19,7 @@ public class MoltenWalkerEnchantment extends QuEnchantment { - private static final ModConfig.MoltenWalkerOptions CONFIG = QuEnchantments.getConfig().moltenWalkerOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public MoltenWalkerEnchantment(Properties properties) { super(properties); @@ -28,19 +27,14 @@ public MoltenWalkerEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.moltenWalkerRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.moltenWalkerBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isTreasure() { return true; @@ -48,7 +42,7 @@ public boolean isTreasure() { @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.moltenWalkerEnchantingTable; } @Override @@ -64,7 +58,7 @@ public void tickEquippedWhileMoving(LivingEntity entity, BlockPos pos, ItemStack if (world.isClient || !entity.isOnGround()) return; BlockState hotObsidianDefaultState = ModBlocks.HOT_OBSIDIAN.getDefaultState(); - int radius = Math.min(16, CONFIG.radius + level - 1); + int radius = Math.min(16, CONFIG.moltenWalkerRadius + level - 1); BlockPos.Mutable mutable = new BlockPos.Mutable(); for (BlockPos blockPosItr : BlockPos.iterate(pos.add(-radius, -1, -radius), pos.add(radius, -1, radius))) { if (!blockPosItr.isWithinDistance(entity.getPos(), radius)) continue; diff --git a/src/main/java/qu/quEnchantments/enchantments/armor/SkywalkerEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/armor/SkywalkerEnchantment.java index a557f54..2ad6e1e 100644 --- a/src/main/java/qu/quEnchantments/enchantments/armor/SkywalkerEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/armor/SkywalkerEnchantment.java @@ -10,7 +10,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.blocks.ModBlocks; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.util.config.ModConfig; @@ -19,30 +18,25 @@ public class SkywalkerEnchantment extends CorruptedEnchantment { public static final float SINK_DISTANCE = 0.875f; - private static final ModConfig.SkywalkerOptions CONFIG = QuEnchantments.getConfig().skywalkerOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public SkywalkerEnchantment(Properties properties) { super(EnchantmentType.WALKER, properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.skywalkerBookOffer; } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.skywalkerRandomSelection; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.skywalkerEnchantingTable; } @Override @@ -57,7 +51,7 @@ public void tickEquippedWhileMoving(LivingEntity entity, BlockPos pos, ItemStack if ((world = entity.getWorld()).isClient || !entity.isOnGround() || !entity.isSneaking()) return; final BlockState cloudDefaultState = ModBlocks.CLOUD.getDefaultState(); - final int radius = Math.min(16, CONFIG.radius); + final int radius = Math.min(16, CONFIG.skywalkerRadius); for (BlockPos blockPosItr : BlockPos.iterate( new BlockPos(entity.getBlockX() - radius, Math.round((float)entity.getY() - SINK_DISTANCE), entity.getBlockZ() - radius), @@ -71,7 +65,7 @@ public void tickEquippedWhileMoving(LivingEntity entity, BlockPos pos, ItemStack world.setBlockState(blockPosItr, cloudDefaultState); int overworldMultiplier = world.getDimension().ultrawarm() ? 1 : 2; - int duration = Math.max(1, CONFIG.cloudDuration) * overworldMultiplier * level; + int duration = Math.max(1, CONFIG.skywalkerCloudDuration) * overworldMultiplier * level; world.scheduleBlockTick( blockPosItr, ModBlocks.CLOUD, diff --git a/src/main/java/qu/quEnchantments/enchantments/rune/AggressionBlessingEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/rune/AggressionBlessingEnchantment.java index a2629c0..f519642 100644 --- a/src/main/java/qu/quEnchantments/enchantments/rune/AggressionBlessingEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/rune/AggressionBlessingEnchantment.java @@ -6,7 +6,6 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; import qu.quEnchantments.util.interfaces.IEntity; @@ -15,10 +14,11 @@ public class AggressionBlessingEnchantment extends QuEnchantment { - private static final ModConfig.AggressionBlessingOptions CONFIG = QuEnchantments.getConfig().aggressionBlessingOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); + public static final EntityAttributeModifier ATTACK_BOOST = new EntityAttributeModifier( UUID.fromString("75924c77-91f8-4db6-b604-0e7ebaf9c429"), - "enchantment attack boost", CONFIG.attackSpeed, + "enchantment attack boost", CONFIG.aggressionBlessingAttackSpeed, EntityAttributeModifier.Operation.ADD_VALUE ); @@ -28,22 +28,17 @@ public AggressionBlessingEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.agitationCurseRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.agitationCurseBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 1 : 0; -// } - @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.aggressionBlessingEnchantingTable; } @Override diff --git a/src/main/java/qu/quEnchantments/enchantments/rune/OmenOfImmunityEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/rune/OmenOfImmunityEnchantment.java index 606552e..e27bf9a 100644 --- a/src/main/java/qu/quEnchantments/enchantments/rune/OmenOfImmunityEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/rune/OmenOfImmunityEnchantment.java @@ -5,7 +5,6 @@ import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.enchantments.ModEnchantments; import qu.quEnchantments.util.config.ModConfig; @@ -15,17 +14,12 @@ public class OmenOfImmunityEnchantment extends CorruptedEnchantment { - private static final ModConfig.OmenOfImmunityOptions CONFIG = QuEnchantments.getConfig().omenOfImmunityOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public OmenOfImmunityEnchantment(Properties properties) { super(EnchantmentType.RUNE, properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 5 : 0; -// } - @Override public boolean isTreasure() { return true; @@ -33,17 +27,17 @@ public boolean isTreasure() { @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.omenOfImmunityBookOffer; } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.omenOfImmunityRandomSelection; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.omenOfImmunityEnchantingTable; } @Override @@ -51,7 +45,7 @@ public void tickWhileEquipped(LivingEntity wearer, ItemStack stack, int level) { Map.Entry entry = EnchantmentHelper.chooseEquipmentWith(ModEnchantments.OMEN_OF_IMMUNITY, wearer, itemStack -> itemStack == stack); if (!(wearer instanceof PlayerEntity player && player.getAbilities().creativeMode) && wearer.age % 20 == 0) { stack.setDamage(Math.min(stack.getMaxDamage(), stack.getDamage() + 6 - level)); - if (stack.getDamage() >= stack.getMaxDamage() && CONFIG.breakOnNoDurability && entry != null) { + if (stack.getDamage() >= stack.getMaxDamage() && CONFIG.omenOfImmunityBreakOnNoDurability && entry != null) { stack.damage(1, wearer, entry.getKey()); } } diff --git a/src/main/java/qu/quEnchantments/enchantments/rune/RegenerationBlessingEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/rune/RegenerationBlessingEnchantment.java index d67f210..80825c3 100644 --- a/src/main/java/qu/quEnchantments/enchantments/rune/RegenerationBlessingEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/rune/RegenerationBlessingEnchantment.java @@ -4,7 +4,6 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.world.GameRules; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.mixin.HungerManagerAccessor; import qu.quEnchantments.util.config.ModConfig; @@ -12,7 +11,7 @@ public class RegenerationBlessingEnchantment extends QuEnchantment { - private static final ModConfig.RegenerationBlessingOptions CONFIG = QuEnchantments.getConfig().regenerationBlessingOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public RegenerationBlessingEnchantment(Properties properties) { super(properties); @@ -20,22 +19,17 @@ public RegenerationBlessingEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.reflectionRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.reflectionBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 1 : 0; -// } - @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.regenerationBlessingEnchantingTable; } @Override diff --git a/src/main/java/qu/quEnchantments/enchantments/rune/SpeedBlessingEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/rune/SpeedBlessingEnchantment.java index e7bfe03..b747513 100644 --- a/src/main/java/qu/quEnchantments/enchantments/rune/SpeedBlessingEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/rune/SpeedBlessingEnchantment.java @@ -6,7 +6,6 @@ import net.minecraft.entity.attribute.EntityAttributes; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; import qu.quEnchantments.util.interfaces.IEntity; @@ -15,10 +14,11 @@ public class SpeedBlessingEnchantment extends QuEnchantment { - private static final ModConfig.SpeedBlessingOptions CONFIG = QuEnchantments.getConfig().speedBlessingOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); + public static final EntityAttributeModifier SPEED_BOOST = new EntityAttributeModifier( UUID.fromString("8d32ac69-5bac-4e72-856f-998074238b0d"), - "enchantment speed boost", 0.1 * CONFIG.speedBoost, + "enchantment speed boost", 0.1 * CONFIG.speedBlessingSpeedBoost, EntityAttributeModifier.Operation.ADD_VALUE ); @@ -28,22 +28,18 @@ public SpeedBlessingEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.speedBlessingRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.speedBlessingBookOffer; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 1 : 0; -// } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.speedBlessingEnchantingTable; } @Override diff --git a/src/main/java/qu/quEnchantments/enchantments/shield/BashingEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/shield/BashingEnchantment.java index c018c2e..3f0f162 100644 --- a/src/main/java/qu/quEnchantments/enchantments/shield/BashingEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/shield/BashingEnchantment.java @@ -9,7 +9,6 @@ import net.minecraft.sound.SoundEvents; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; @@ -18,7 +17,7 @@ public class BashingEnchantment extends QuEnchantment { - private static final ModConfig.BashingOptions CONFIG = QuEnchantments.getConfig().bashingOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public BashingEnchantment(Properties properties) { super(properties); @@ -31,17 +30,17 @@ public BashingEnchantment(Properties properties) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.bashingRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.bashingBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.bashingEnchantingTable; } @Override @@ -55,7 +54,7 @@ public void onBlock(LivingEntity defender, LivingEntity attacker, ItemStack stac dz = (Math.random() - Math.random()) * 0.01; } //attacker.knockbackVelocity = (float) (MathHelper.atan2(dz, dx) * 57.2957763671875 - (double) attacker.getYaw()); - attacker.takeKnockback(CONFIG.knockbackStrength, dx, dz); + attacker.takeKnockback(CONFIG.bashingKnockbackStrength, dx, dz); if (EnchantmentHelper.getLevel(ModEnchantments.NIGHTBLOOD, stack) > 0) { Map.Entry entry = EnchantmentHelper.chooseEquipmentWith(ModEnchantments.BASHING, defender); if (entry != null) { diff --git a/src/main/java/qu/quEnchantments/enchantments/shield/ReflectionEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/shield/ReflectionEnchantment.java index 5304ca3..f2252b2 100644 --- a/src/main/java/qu/quEnchantments/enchantments/shield/ReflectionEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/shield/ReflectionEnchantment.java @@ -7,37 +7,31 @@ import net.minecraft.entity.projectile.TridentEntity; import net.minecraft.util.hit.EntityHitResult; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class ReflectionEnchantment extends QuEnchantment { - private static final ModConfig.ReflectionOptions CONFIG = QuEnchantments.getConfig().reflectionOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public ReflectionEnchantment(Properties properties) { super(properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 3 : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.reflectionRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.reflectionBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.reflectionEnchantingTable; } public static boolean reflect(PersistentProjectileEntity projectile, EntityHitResult result) { @@ -57,7 +51,7 @@ public static boolean reflect(PersistentProjectileEntity projectile, EntityHitRe player.getPitch() - 1.0f, player.getYaw(), 0.0f, (float)projectile.getVelocity().length(), - 25.0f * (CONFIG.divergence * 0.1f) / reflectionLevel + 25.0f * (CONFIG.reflectionDivergence * 0.1f) / reflectionLevel ); return true; diff --git a/src/main/java/qu/quEnchantments/enchantments/tool/LuckyMinerEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/tool/LuckyMinerEnchantment.java index 37db6d8..c3ce71b 100644 --- a/src/main/java/qu/quEnchantments/enchantments/tool/LuckyMinerEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/tool/LuckyMinerEnchantment.java @@ -17,36 +17,31 @@ import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CompoundEnchantment; import qu.quEnchantments.util.ModLootTableModifier; import qu.quEnchantments.util.config.ModConfig; public class LuckyMinerEnchantment extends CompoundEnchantment { - private static final ModConfig.LuckyMinerOptions CONFIG = QuEnchantments.getConfig().luckyMinerOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); + public LuckyMinerEnchantment(Properties properties) { super(properties); } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.luckyMinerEnchantingTable; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? super.getMaxLevel() : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.luckyMinerRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.luckyMinerBookOffer; } @Override diff --git a/src/main/java/qu/quEnchantments/enchantments/tool/StripMinerEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/tool/StripMinerEnchantment.java index 6a36533..d564bd1 100644 --- a/src/main/java/qu/quEnchantments/enchantments/tool/StripMinerEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/tool/StripMinerEnchantment.java @@ -8,7 +8,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.event.GameEvent; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.util.config.ModConfig; import qu.quEnchantments.world.ModWorldEvents; @@ -18,30 +17,26 @@ public class StripMinerEnchantment extends CorruptedEnchantment { - private static final ModConfig.StripMinerOptions CONFIG = QuEnchantments.getConfig().stripMinerOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public StripMinerEnchantment(Properties properties) { super(EnchantmentType.PICKAXE_DROP, properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.stripMinerRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.stripMinerBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.stripMinerEnchantingTable; } @Override @@ -63,7 +58,7 @@ public void onBlockBreak(PlayerEntity player, BlockPos pos, ItemStack stack, int } iterable = temp; } else { - int radius = CONFIG.radius; + int radius = CONFIG.stripMinerRadius; iterable = BlockPos.iterate(pos.add(-radius, -radius, -radius), pos.add(radius, radius, radius)); } diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/AccuracyEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/AccuracyEnchantment.java index 7877d70..27d37fb 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/AccuracyEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/AccuracyEnchantment.java @@ -1,34 +1,28 @@ package qu.quEnchantments.enchantments.weapon; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class AccuracyEnchantment extends QuEnchantment { - private static final ModConfig.AccuracyOptions CONFIG = QuEnchantments.getConfig().accuracyOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public AccuracyEnchantment(Properties properties) { super(properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.accuracyRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.accuracyBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.accuracyEnchantingTable; } } diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/ArrowsFlightEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/ArrowsFlightEnchantment.java index 43db25b..1899e0c 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/ArrowsFlightEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/ArrowsFlightEnchantment.java @@ -1,34 +1,29 @@ package qu.quEnchantments.enchantments.weapon; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class ArrowsFlightEnchantment extends QuEnchantment { - public static final ModConfig.ArrowsFlightOptions CONFIG = QuEnchantments.getConfig().arrowsFlightOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public ArrowsFlightEnchantment(Properties properties) { super(properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.arrowsFlightRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.arrowsFlightBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.arrowsFlightEnchantingTable; } } diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/FreezingAspectEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/FreezingAspectEnchantment.java index 4226d86..2d490b6 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/FreezingAspectEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/FreezingAspectEnchantment.java @@ -9,13 +9,12 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class FreezingAspectEnchantment extends QuEnchantment { - private static final ModConfig.FreezingAspectOptions CONFIG = QuEnchantments.getConfig().freezingAspectOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public FreezingAspectEnchantment(Properties properties) { super(properties); @@ -33,17 +32,17 @@ public boolean canAccept(Enchantment other) { @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.freezingAspectRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.freezingAspectBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.freezingAspectEnchantingTable; } @Override @@ -53,7 +52,7 @@ public void onTargetDamaged(LivingEntity user, ItemStack stack, Entity target, i target.extinguish(); if (target.canFreeze()) { - target.setFrozenTicks(target.getMinFreezeDamageTicks() + CONFIG.duration * level); + target.setFrozenTicks(target.getMinFreezeDamageTicks() + CONFIG.freezingAspectDuration * level); } Random random = world.getRandom(); diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/InaneAspectEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/InaneAspectEnchantment.java index 9fcb67b..c09e1c2 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/InaneAspectEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/InaneAspectEnchantment.java @@ -5,14 +5,13 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.item.ItemStack; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; import qu.quEnchantments.util.interfaces.IEntity; public class InaneAspectEnchantment extends QuEnchantment { - private static final ModConfig.InaneAspectOptions CONFIG = QuEnchantments.getConfig().inaneAspectOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public InaneAspectEnchantment(Properties properties) { super(properties); @@ -23,30 +22,24 @@ public boolean canAccept(Enchantment other) { return !(other == Enchantments.FIRE_ASPECT || other instanceof FreezingAspectEnchantment || other instanceof LeechingAspectEnchantment) && super.canAccept(other); } - -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.inaneAspectRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.inaneAspectBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.inaneAspectEnchantingTable; } @Override public void onTargetDamaged(LivingEntity user, ItemStack stack, Entity target, int level) { if (user.getWorld().isClient) return; - ((IEntity)target).setInaneTicks(40 + CONFIG.duration * level); + ((IEntity)target).setInaneTicks(40 + CONFIG.inaneAspectDuration * level); } } diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/LeechingAspectEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/LeechingAspectEnchantment.java index 2122041..f116d8f 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/LeechingAspectEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/LeechingAspectEnchantment.java @@ -11,13 +11,12 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.QuEnchantment; import qu.quEnchantments.util.config.ModConfig; public class LeechingAspectEnchantment extends QuEnchantment { - private static final ModConfig.LeechingAspectOptions CONFIG = QuEnchantments.getConfig().leechingAspectOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public LeechingAspectEnchantment(Properties properties) { super(properties); @@ -28,24 +27,19 @@ public boolean canAccept(Enchantment other) { return !(other == Enchantments.FIRE_ASPECT || other instanceof FreezingAspectEnchantment || other instanceof InaneAspectEnchantment) && super.canAccept(other); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.leechingAspectRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.leechingAspectBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.leechingAspectEnchantingTable; } @Override @@ -54,7 +48,7 @@ public void onTargetDamaged(LivingEntity user, ItemStack stack, Entity target, i if ((world = user.getWorld()).isClient) return; user.addStatusEffect(new StatusEffectInstance(StatusEffects.REGENERATION, 20, 0, false, false, false)); - user.heal(CONFIG.healing * level); + user.heal(CONFIG.leechingAspectHealing * level); Random random = world.getRandom(); double d = random.nextGaussian() * 0.02; diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/LightningBoundEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/LightningBoundEnchantment.java index 0914a6a..fd35d86 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/LightningBoundEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/LightningBoundEnchantment.java @@ -6,13 +6,12 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CompoundEnchantment; import qu.quEnchantments.util.config.ModConfig; public class LightningBoundEnchantment extends CompoundEnchantment { - private static final ModConfig.LightningBoundOptions CONFIG = QuEnchantments.getConfig().lightningBoundOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public LightningBoundEnchantment(Properties properties) { super(properties); @@ -20,24 +19,19 @@ public LightningBoundEnchantment(Properties properties) { @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.lightningBoundEnchantingTable; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.lightningBoundBookOffer; } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.lightningBoundRandomSelection; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? super.getMaxLevel() : 0; -// } - @Override public void onTargetDamaged(LivingEntity user, ItemStack stack, Entity target, int level) { World world; diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/NightbloodEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/NightbloodEnchantment.java index b702755..ecfb67b 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/NightbloodEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/NightbloodEnchantment.java @@ -19,7 +19,6 @@ import net.minecraft.server.world.ServerWorld; import net.minecraft.util.math.random.Random; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.enchantments.ModEnchantments; import qu.quEnchantments.util.ModTags; @@ -31,7 +30,8 @@ public class NightbloodEnchantment extends CorruptedEnchantment { - private static final ModConfig.NightbloodOptions CONFIG = QuEnchantments.getConfig().nightbloodOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); + private static final ImmutableMap ARMOR_CHANCE_MAP = ImmutableMap.of( ArmorItem.Type.HELMET, 0.2f, ArmorItem.Type.CHESTPLATE, 0.4f, @@ -43,24 +43,19 @@ public NightbloodEnchantment(Properties properties) { super(EnchantmentType.ASPECT, properties); } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 2 : 0; -// } - @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.nightbloodRandomSelection; } @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.nightbloodBookOffer; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.nightbloodEnchantingTable; } @Override @@ -83,7 +78,7 @@ public float getAttackDamage(Entity target, ItemStack stack, int level) { if ((key = Registries.ENTITY_TYPE.getKey(target.getType())).isPresent() && (entry = Registries.ENTITY_TYPE.getEntry(key.get())).isPresent() && entry.get().isIn(ModTags.NIGHTBLOOD_IMMUNE_ENTITIES)) { - livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, CONFIG.witherDuration, CONFIG.witherAmplifier, false, true), livingEntity.getAttacker()); + livingEntity.addStatusEffect(new StatusEffectInstance(StatusEffects.WITHER, CONFIG.nightbloodWitherDuration, CONFIG.nightbloodWitherAmplifier, false, true), livingEntity.getAttacker()); return 0.0f; } @@ -102,7 +97,7 @@ public float getAttackDamage(Entity target, ItemStack stack, int level) { } } - if (CONFIG.disablesExperience) livingEntity.disableExperienceDropping(); + if (CONFIG.nightbloodDisablesExperience) livingEntity.disableExperienceDropping(); return 1000000.0f; } @@ -115,16 +110,16 @@ public void tickWhileEquipped(LivingEntity wearer, ItemStack stack, int level) { if (player.getAbilities().creativeMode) return; if (player.experienceLevel > 0 || player.experienceProgress > 0) { - player.addExperience((int) (-4 * CONFIG.drainRate / level)); + player.addExperience((int) (-4 * CONFIG.nightbloodDrainRate / level)); return; } if (world.getDifficulty().getId() != 0 && player.getHungerManager().getFoodLevel() > 0) { - player.getHungerManager().addExhaustion(1.5f * CONFIG.drainRate / level); + player.getHungerManager().addExhaustion(1.5f * CONFIG.nightbloodDrainRate / level); return; } } - wearer.damage(world.getDamageSources().magic(), 2.0f * CONFIG.drainRate / level); + wearer.damage(world.getDamageSources().magic(), 2.0f * CONFIG.nightbloodDrainRate / level); } } diff --git a/src/main/java/qu/quEnchantments/enchantments/weapon/ShapedGlassEnchantment.java b/src/main/java/qu/quEnchantments/enchantments/weapon/ShapedGlassEnchantment.java index 553bd7c..185f4c1 100644 --- a/src/main/java/qu/quEnchantments/enchantments/weapon/ShapedGlassEnchantment.java +++ b/src/main/java/qu/quEnchantments/enchantments/weapon/ShapedGlassEnchantment.java @@ -4,13 +4,12 @@ import net.minecraft.item.AxeItem; import net.minecraft.item.ItemStack; import org.jetbrains.annotations.Nullable; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.CorruptedEnchantment; import qu.quEnchantments.util.config.ModConfig; public class ShapedGlassEnchantment extends CorruptedEnchantment { - private static final ModConfig.ShapedGlassOptions CONFIG = QuEnchantments.getConfig().shapedGlassOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public ShapedGlassEnchantment(Properties properties) { super(EnchantmentType.DAMAGE, properties); @@ -18,27 +17,22 @@ public ShapedGlassEnchantment(Properties properties) { @Override public float getAttackDamage(int level, @Nullable EntityType entityType) { - return level * CONFIG.damageMultiplier; + return level * CONFIG.shapedGlassDamageMultiplier; } -// @Override -// public int getMaxLevel() { -// return CONFIG.isEnabled ? 5 : 0; -// } - @Override public boolean isAvailableForEnchantedBookOffer() { - return CONFIG.bookOffer; + return CONFIG.shapedGlassBookOffer; } @Override public boolean isAvailableForRandomSelection() { - return CONFIG.randomSelection; + return CONFIG.shapedGlassRandomSelection; } @Override public boolean isAvailableForEnchantingTable() { - return CONFIG.enchantingTable; + return CONFIG.shapedGlassEnchantingTable; } @Override diff --git a/src/main/java/qu/quEnchantments/items/RuneItem.java b/src/main/java/qu/quEnchantments/items/RuneItem.java index 980cdf5..333cd94 100644 --- a/src/main/java/qu/quEnchantments/items/RuneItem.java +++ b/src/main/java/qu/quEnchantments/items/RuneItem.java @@ -10,7 +10,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.world.World; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; import qu.quEnchantments.util.config.ModConfig; import qu.quEnchantments.util.interfaces.IItemStack; @@ -19,7 +18,7 @@ public class RuneItem extends Item { - private static final ModConfig.RuneOptions CONFIG = QuEnchantments.getConfig().runeOptions; + private static final ModConfig CONFIG = ModConfig.CONFIG_HANDLER.instance(); public RuneItem(Settings settings) { super(settings); @@ -44,7 +43,7 @@ public void inventoryTick(ItemStack stack, World world, Entity entity, int slot, ((selected || (entity instanceof LivingEntity livingEntity && livingEntity.getOffHandStack() == stack)) && !(entity instanceof PlayerEntity player && player.getAbilities().creativeMode))) return; stack.setDamage(Math.max(0, stack.getDamage() - 1)); - if (CONFIG.breakOnNoDurability && entity instanceof LivingEntity livingEntity && stack.getDamage() >= stack.getMaxDamage()) { + if (CONFIG.runeBreakOnNoDurability && entity instanceof LivingEntity livingEntity && stack.getDamage() >= stack.getMaxDamage()) { Map.Entry entry = EnchantmentHelper.chooseEquipmentWith(ModEnchantments.BASHING, livingEntity); if (entry != null) { stack.damage(1, livingEntity, entry.getKey()); diff --git a/src/main/java/qu/quEnchantments/mixin/BowItemMixin.java b/src/main/java/qu/quEnchantments/mixin/BowItemMixin.java index 540bd18..8c4b0d9 100644 --- a/src/main/java/qu/quEnchantments/mixin/BowItemMixin.java +++ b/src/main/java/qu/quEnchantments/mixin/BowItemMixin.java @@ -9,8 +9,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; +import qu.quEnchantments.util.config.ModConfig; @Mixin(BowItem.class) public class BowItemMixin { @@ -22,7 +22,7 @@ public class BowItemMixin { int lvl; if ((lvl = EnchantmentHelper.getLevel(ModEnchantments.ARROWS_FLIGHT, stack)) > 0) { // the 6th arg is the speed variable - args.set(6, (float)args.get(6) + lvl * 0.5f * QuEnchantments.getConfig().arrowsFlightOptions.arrowSpeed); + args.set(6, (float)args.get(6) + lvl * 0.5f * ModConfig.CONFIG_HANDLER.instance().arrowsFlightArrowSpeed); } } } diff --git a/src/main/java/qu/quEnchantments/mixin/MiningToolItemMixin.java b/src/main/java/qu/quEnchantments/mixin/MiningToolItemMixin.java index 0de0ce6..4bab97b 100644 --- a/src/main/java/qu/quEnchantments/mixin/MiningToolItemMixin.java +++ b/src/main/java/qu/quEnchantments/mixin/MiningToolItemMixin.java @@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; +import qu.quEnchantments.util.config.ModConfig; @Mixin(MiningToolItem.class) public class MiningToolItemMixin { @@ -18,7 +18,7 @@ public class MiningToolItemMixin { private void quEnchantments$setItemPostHitDamageForShapedGlass(Args args, ItemStack stack, LivingEntity target, LivingEntity attacker) { int shapedGlassLevel; if ((shapedGlassLevel = EnchantmentHelper.getLevel(ModEnchantments.SHAPED_GLASS, stack)) > 0) { - args.set(0, (int)((20 + (shapedGlassLevel - 1) * 2) * QuEnchantments.getConfig().shapedGlassOptions.itemDamage)); + args.set(0, ModConfig.CONFIG_HANDLER.instance().shapedGlassItemDamage + (shapedGlassLevel - 1) * 2); } } diff --git a/src/main/java/qu/quEnchantments/mixin/SwordItemMixin.java b/src/main/java/qu/quEnchantments/mixin/SwordItemMixin.java index e5816f8..986d74d 100644 --- a/src/main/java/qu/quEnchantments/mixin/SwordItemMixin.java +++ b/src/main/java/qu/quEnchantments/mixin/SwordItemMixin.java @@ -8,8 +8,8 @@ import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.ModifyArgs; import org.spongepowered.asm.mixin.injection.invoke.arg.Args; -import qu.quEnchantments.QuEnchantments; import qu.quEnchantments.enchantments.ModEnchantments; +import qu.quEnchantments.util.config.ModConfig; @Mixin(SwordItem.class) public class SwordItemMixin { @@ -18,7 +18,7 @@ public class SwordItemMixin { private void quEnchantments$setItemPostHitDamageForShapedGlass(Args args, ItemStack stack, LivingEntity target, LivingEntity attacker) { int shapedGlassLevel; if ((shapedGlassLevel = EnchantmentHelper.getLevel(ModEnchantments.SHAPED_GLASS, stack)) > 0) { - args.set(0, (int)((20 + (shapedGlassLevel - 1) * 2) * QuEnchantments.getConfig().shapedGlassOptions.itemDamage)); + args.set(0, ModConfig.CONFIG_HANDLER.instance().shapedGlassItemDamage + (shapedGlassLevel - 1) * 2); } } } diff --git a/src/main/java/qu/quEnchantments/util/config/ModConfig.java b/src/main/java/qu/quEnchantments/util/config/ModConfig.java index 0e3a47b..c0c74ad 100644 --- a/src/main/java/qu/quEnchantments/util/config/ModConfig.java +++ b/src/main/java/qu/quEnchantments/util/config/ModConfig.java @@ -1,283 +1,283 @@ package qu.quEnchantments.util.config; -import me.shedaniel.autoconfig.ConfigData; -import me.shedaniel.autoconfig.annotation.Config; -import me.shedaniel.autoconfig.annotation.ConfigEntry; -import net.minecraft.util.math.MathHelper; +import com.google.gson.GsonBuilder; +import dev.isxander.yacl3.config.v2.api.ConfigClassHandler; +import dev.isxander.yacl3.config.v2.api.SerialEntry; +import dev.isxander.yacl3.config.v2.api.serializer.GsonConfigSerializerBuilder; +import net.fabricmc.loader.api.FabricLoader; +import net.minecraft.util.Identifier; import qu.quEnchantments.QuEnchantments; -@Config(name = QuEnchantments.MOD_ID) -//@Config.Gui.Background("qu-enchantments:textures/block/hot_obsidian_2.png") -public class ModConfig implements ConfigData { - - @ConfigEntry.Gui.TransitiveObject - public final RuneOptions runeOptions = new RuneOptions(); - - @ConfigEntry.Gui.CollapsibleObject - public final AccuracyOptions accuracyOptions = new AccuracyOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final AggressionBlessingOptions aggressionBlessingOptions = new AggressionBlessingOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final AgitationCurseOptions agitationCurseOptions = new AgitationCurseOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final ArrowsFlightOptions arrowsFlightOptions = new ArrowsFlightOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final BashingOptions bashingOptions = new BashingOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final EssenceOfEnderOptions essenceOfEnderOptions = new EssenceOfEnderOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final FidelityOptions fidelityOptions = new FidelityOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final FreezingAspectOptions freezingAspectOptions = new FreezingAspectOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final InaneAspectOptions inaneAspectOptions = new InaneAspectOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final LeechingAspectOptions leechingAspectOptions = new LeechingAspectOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final LightningBoundOptions lightningBoundOptions = new LightningBoundOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final LuckyMinerOptions luckyMinerOptions = new LuckyMinerOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final MoltenWalkerOptions moltenWalkerOptions = new MoltenWalkerOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final NightbloodOptions nightbloodOptions = new NightbloodOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final OmenOfImmunityOptions omenOfImmunityOptions = new OmenOfImmunityOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final ReflectionOptions reflectionOptions = new ReflectionOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final RegenerationBlessingOptions regenerationBlessingOptions = new RegenerationBlessingOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final ShapedGlassOptions shapedGlassOptions = new ShapedGlassOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final SkywalkerOptions skywalkerOptions = new SkywalkerOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final SpeedBlessingOptions speedBlessingOptions = new SpeedBlessingOptions(); - @ConfigEntry.Gui.CollapsibleObject - public final StripMinerOptions stripMinerOptions = new StripMinerOptions(); - - public static class RuneOptions { - @ConfigEntry.Gui.Tooltip - public boolean breakOnNoDurability = false; - } - - public static class AccuracyOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - } - - public static class AggressionBlessingOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - @ConfigEntry.Gui.Tooltip - public float attackSpeed = 0.8f; // REQUIRES RESTART - } - - public static class AgitationCurseOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean bookOffer = false; - @ConfigEntry.BoundedDiscrete(min = 8, max = 64) - public double radius = 16.0; - } - - public static class ArrowsFlightOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public float arrowSpeed = 1.0f; - } - - public static class BashingOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public float knockbackStrength = 0.6f; - - } - - public static class EssenceOfEnderOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - @ConfigEntry.BoundedDiscrete(min = 2, max = 8) - public int entityTeleportDistance = 5; - } - - public static class FidelityOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - } - - public static class FreezingAspectOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public int duration = 75; - } - - public static class InaneAspectOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public int duration = 40; - } - - public static class LeechingAspectOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public float healing = 0.25f; - } - - public static class LightningBoundOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - } - - public static class LuckyMinerOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = false; - public boolean bookOffer = true; - } - - public static class MoltenWalkerOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - @ConfigEntry.BoundedDiscrete(max = 16) - public int radius = 2; - } - - public static class NightbloodOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - public boolean disablesExperience = true; - @ConfigEntry.Gui.Tooltip - public int witherDuration = 200; - @ConfigEntry.BoundedDiscrete(max = 255) - public int witherAmplifier = 1; - @ConfigEntry.Gui.Tooltip - public float drainRate = 1.0f; +public class ModConfig { + + public static ConfigClassHandler CONFIG_HANDLER = ConfigClassHandler.createBuilder(ModConfig.class) + .id(new Identifier(QuEnchantments.MOD_ID, "configuration")) + .serializer(config -> GsonConfigSerializerBuilder.create(config) + .setPath(FabricLoader.getInstance().getConfigDir().resolve(QuEnchantments.MOD_ID + ".json5")) + .appendGsonBuilder(GsonBuilder::setPrettyPrinting) + .setJson5(true) + .build()) + .build(); + + static { + if (!CONFIG_HANDLER.load()) { + QuEnchantments.LOGGER.warn("Unable to load configuration file. Perhaps it doesn't exist yet?"); + } } - public static class OmenOfImmunityOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - public boolean breakOnNoDurability = true; - } - - public static class ReflectionOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - public float divergence = 1.0f; - } - - public static class RegenerationBlessingOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - } - - public static class ShapedGlassOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - public float damageMultiplier = 2.0f; - public float itemDamage = 1.0f; - } - - public static class SkywalkerOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - @ConfigEntry.Gui.Tooltip - @ConfigEntry.BoundedDiscrete(max = 16) - public int radius = 0; - @ConfigEntry.Gui.Tooltip - public int cloudDuration = 25; - } - - public static class SpeedBlessingOptions { - public boolean isEnabled = true; - public boolean randomSelection = true; - public boolean enchantingTable = true; - public boolean bookOffer = true; - @ConfigEntry.Gui.Tooltip - public float speedBoost = 0.2f; - } - - public static class StripMinerOptions { - public boolean isEnabled = true; - public boolean randomSelection = false; - public boolean enchantingTable = false; - public boolean bookOffer = false; - @ConfigEntry.Gui.Tooltip - @ConfigEntry.BoundedDiscrete(min = 1, max = 16) - public int radius = 1; - } - - @Override - public void validatePostLoad() { - aggressionBlessingOptions.attackSpeed = MathHelper.clamp(aggressionBlessingOptions.attackSpeed, 0.0f, 255.0f); - - agitationCurseOptions.radius = MathHelper.clamp(agitationCurseOptions.radius, 0.0, 64.0); - - arrowsFlightOptions.arrowSpeed = MathHelper.clamp(arrowsFlightOptions.arrowSpeed, 0.0f, 20.0f); - - bashingOptions.knockbackStrength = MathHelper.clamp(bashingOptions.knockbackStrength, 0.01f, 100.0f); - - essenceOfEnderOptions.entityTeleportDistance = MathHelper.clamp(essenceOfEnderOptions.entityTeleportDistance, 2, 8); - - freezingAspectOptions.duration = MathHelper.clamp(freezingAspectOptions.duration, 0, 99999); - - inaneAspectOptions.duration = MathHelper.clamp(inaneAspectOptions.duration, 0, 99999); - - leechingAspectOptions.healing = MathHelper.clamp(leechingAspectOptions.healing, 0.0f, 99999.0f); - - moltenWalkerOptions.radius = MathHelper.clamp(moltenWalkerOptions.radius, 0, 16); - - nightbloodOptions.witherDuration = MathHelper.clamp(nightbloodOptions.witherDuration, 0, 99999); - nightbloodOptions.witherAmplifier = MathHelper.clamp(nightbloodOptions.witherAmplifier, 0, 255); - nightbloodOptions.drainRate = MathHelper.clamp(nightbloodOptions.drainRate, 0.0f, 99999.0f); - - reflectionOptions.divergence = MathHelper.clamp(reflectionOptions.divergence, 0.0f, 20.0f); - - shapedGlassOptions.damageMultiplier = MathHelper.clamp(shapedGlassOptions.damageMultiplier, 0.0f, 99999.9f); - shapedGlassOptions.itemDamage = MathHelper.clamp(shapedGlassOptions.itemDamage, 0, 99999); - - skywalkerOptions.radius = MathHelper.clamp(skywalkerOptions.radius, 0, 16); - skywalkerOptions.cloudDuration = MathHelper.clamp(skywalkerOptions.cloudDuration, 1, 99999); - - speedBlessingOptions.speedBoost = MathHelper.clamp(speedBlessingOptions.speedBoost, 0.0f, 255.0f); - - stripMinerOptions.radius = MathHelper.clamp(stripMinerOptions.radius, 1, 16); - - QuEnchantments.LOGGER.info("Finished validating config for " + QuEnchantments.MOD_ID); - } + // Rune options + @SerialEntry + public boolean runeBreakOnNoDurability = false; + + // Accuracy options + @SerialEntry + public boolean accuracyEnabled = true; + @SerialEntry + public boolean accuracyRandomSelection = true; + @SerialEntry + public boolean accuracyEnchantingTable = true; + @SerialEntry + public boolean accuracyBookOffer = true; + + // Aggression Blessing options + @SerialEntry + public boolean aggressionBlessingEnabled = true; + @SerialEntry + public boolean aggressionBlessingRandomSelection = true; + @SerialEntry + public boolean aggressionBlessingEnchantingTable = true; + @SerialEntry + public boolean aggressionBlessingBookOffer = true; + @SerialEntry + public float aggressionBlessingAttackSpeed = 0.8f; + + // Agitation Curse options + @SerialEntry + public boolean agitationCurseEnabled = true; + @SerialEntry + public boolean agitationCurseRandomSelection = false; + @SerialEntry + public boolean agitationCurseBookOffer = false; + @SerialEntry + public double agitationCurseRadius = 16.0; + + // Arrows Flight options + @SerialEntry + public boolean arrowsFlightEnabled = true; + @SerialEntry + public boolean arrowsFlightRandomSelection = true; + @SerialEntry + public boolean arrowsFlightEnchantingTable = true; + @SerialEntry + public boolean arrowsFlightBookOffer = true; + @SerialEntry + public float arrowsFlightArrowSpeed = 1.0f; + + // Bashing options + @SerialEntry + public boolean bashingEnabled = true; + @SerialEntry + public boolean bashingRandomSelection = true; + @SerialEntry + public boolean bashingEnchantingTable = true; + @SerialEntry + public boolean bashingBookOffer = true; + @SerialEntry + public float bashingKnockbackStrength = 0.6f; + + // Essence Of Ender options + @SerialEntry + public boolean essenceOfEnderEnabled = true; + @SerialEntry + public boolean essenceOfEnderRandomSelection = false; + @SerialEntry + public boolean essenceOfEnderEnchantingTable = false; + @SerialEntry + public boolean essenceOfEnderBookOffer = false; + @SerialEntry + public double essenceOfEnderTeleportDistance = 5.0; + + // Fidelity options + @SerialEntry + public boolean fidelityEnabled = true; + @SerialEntry + public boolean fidelityRandomSelection = false; + @SerialEntry + public boolean fidelityEnchantingTable = false; + @SerialEntry + public boolean fidelityBookOffer = false; + + // Freezing Aspect options + @SerialEntry + public boolean freezingAspectEnabled = true; + @SerialEntry + public boolean freezingAspectRandomSelection = true; + @SerialEntry + public boolean freezingAspectEnchantingTable = true; + @SerialEntry + public boolean freezingAspectBookOffer = true; + @SerialEntry + public int freezingAspectDuration = 75; + + // Inane Aspect options + @SerialEntry + public boolean inaneAspectEnabled = true; + @SerialEntry + public boolean inaneAspectRandomSelection = true; + @SerialEntry + public boolean inaneAspectEnchantingTable = true; + @SerialEntry + public boolean inaneAspectBookOffer = true; + @SerialEntry + public int inaneAspectDuration = 40; + + // Leeching Aspect options + @SerialEntry + public boolean leechingAspectEnabled = true; + @SerialEntry + public boolean leechingAspectRandomSelection = true; + @SerialEntry + public boolean leechingAspectEnchantingTable = true; + @SerialEntry + public boolean leechingAspectBookOffer = true; + @SerialEntry + public float leechingAspectHealing = 0.25f; + + // Lightning Bound options + @SerialEntry + public boolean lightningBoundEnabled = true; + @SerialEntry + public boolean lightningBoundRandomSelection = true; + @SerialEntry + public boolean lightningBoundEnchantingTable = true; + @SerialEntry + public boolean lightningBoundBookOffer = true; + + // Lucky Miner options + @SerialEntry + public boolean luckyMinerEnabled = true; + @SerialEntry + public boolean luckyMinerRandomSelection = true; + @SerialEntry + public boolean luckyMinerEnchantingTable = false; + @SerialEntry + public boolean luckyMinerBookOffer = true; + + // Molten Walker options + @SerialEntry + public boolean moltenWalkerEnabled = true; + @SerialEntry + public boolean moltenWalkerRandomSelection = true; + @SerialEntry + public boolean moltenWalkerEnchantingTable = true; + @SerialEntry + public boolean moltenWalkerBookOffer = true; + @SerialEntry + public int moltenWalkerRadius = 2; + + // Nightblood options + @SerialEntry + public boolean nightbloodEnabled = true; + @SerialEntry + public boolean nightbloodRandomSelection = false; + @SerialEntry + public boolean nightbloodEnchantingTable = false; + @SerialEntry + public boolean nightbloodBookOffer = false; + @SerialEntry + public boolean nightbloodDisablesExperience = true; + @SerialEntry + public int nightbloodWitherDuration = 200; + @SerialEntry + public int nightbloodWitherAmplifier = 1; + @SerialEntry + public float nightbloodDrainRate = 1.0f; + + // Omen Of Immunity options + @SerialEntry + public boolean omenOfImmunityEnabled = true; + @SerialEntry + public boolean omenOfImmunityRandomSelection = false; + @SerialEntry + public boolean omenOfImmunityEnchantingTable = false; + @SerialEntry + public boolean omenOfImmunityBookOffer = false; + @SerialEntry + public boolean omenOfImmunityBreakOnNoDurability = true; + + // Reflection options + @SerialEntry + public boolean reflectionEnabled = true; + @SerialEntry + public boolean reflectionRandomSelection = true; + @SerialEntry + public boolean reflectionEnchantingTable = true; + @SerialEntry + public boolean reflectionBookOffer = true; + @SerialEntry + public float reflectionDivergence = 1.0f; + + // Regeneration Blessing options + @SerialEntry + public boolean regenerationBlessingEnabled = true; + @SerialEntry + public boolean regenerationBlessingRandomSelection = true; + @SerialEntry + public boolean regenerationBlessingEnchantingTable = true; + @SerialEntry + public boolean regenerationBlessingBookOffer = true; + + // Shaped Glass options + @SerialEntry + public boolean shapedGlassEnabled = true; + @SerialEntry + public boolean shapedGlassRandomSelection = false; + @SerialEntry + public boolean shapedGlassEnchantingTable = false; + @SerialEntry + public boolean shapedGlassBookOffer = false; + @SerialEntry + public float shapedGlassDamageMultiplier = 2.0f; + @SerialEntry + public int shapedGlassItemDamage = 20; + + // Skywalker options + @SerialEntry + public boolean skywalkerEnabled = true; + @SerialEntry + public boolean skywalkerRandomSelection = false; + @SerialEntry + public boolean skywalkerEnchantingTable = false; + @SerialEntry + public boolean skywalkerBookOffer = false; + @SerialEntry + public int skywalkerRadius = 0; + @SerialEntry + public int skywalkerCloudDuration = 25; + @SerialEntry + public boolean skywalkerHalfUltrawarmDuration = true; + + // Speed Blessing options + @SerialEntry + public boolean speedBlessingEnabled = true; + @SerialEntry + public boolean speedBlessingRandomSelection = true; + @SerialEntry + public boolean speedBlessingEnchantingTable = true; + @SerialEntry + public boolean speedBlessingBookOffer = true; + @SerialEntry + public float speedBlessingSpeedBoost = 0.2f; + + // Strip Miner options + @SerialEntry + public boolean stripMinerEnabled = true; + @SerialEntry + public boolean stripMinerRandomSelection = false; + @SerialEntry + public boolean stripMinerEnchantingTable = false; + @SerialEntry + public boolean stripMinerBookOffer = false; + @SerialEntry + public int stripMinerRadius = 1; } diff --git a/src/main/resources/assets/qu-enchantments/icon-512x512.png b/src/main/resources/assets/qu-enchantments/icon-512x512.png new file mode 100644 index 0000000..d438e42 Binary files /dev/null and b/src/main/resources/assets/qu-enchantments/icon-512x512.png differ diff --git a/src/main/resources/assets/qu-enchantments/icon.png b/src/main/resources/assets/qu-enchantments/icon.png index 67d4beb..c29a024 100644 Binary files a/src/main/resources/assets/qu-enchantments/icon.png and b/src/main/resources/assets/qu-enchantments/icon.png differ diff --git a/src/main/resources/assets/qu-enchantments/lang/en_us.json b/src/main/resources/assets/qu-enchantments/lang/en_us.json index 53a0a3a..0be7e73 100644 --- a/src/main/resources/assets/qu-enchantments/lang/en_us.json +++ b/src/main/resources/assets/qu-enchantments/lang/en_us.json @@ -79,159 +79,128 @@ "item.qu-enchantments.rune_7": "Rune", "item.qu-enchantments.rune_8": "Rune", - "text.autoconfig.qu-enchantments.option.runeOptions.breakOnNoDurability": "Runes Can Break: ", - "text.autoconfig.qu-enchantments.option.runeOptions.breakOnNoDurability.@Tooltip": "Whether all runes will break upon reaching 0 durability or not.", - - "text.autoconfig.qu-enchantments.option.accuracyOptions": "Accuracy Enchantment Options", - "text.autoconfig.qu-enchantments.option.accuracyOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.accuracyOptions.randomSelection": "Spawn As Loot: ", - "text.autoconfig.qu-enchantments.option.accuracyOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.accuracyOptions.bookOffer": "Is Tradable: ", - - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions": "Blessing of Aggression Options", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.randomSelection": "Spawn As Loot: ", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.attackSpeed.@Tooltip": "REQUIRES RESTART", - "text.autoconfig.qu-enchantments.option.aggressionBlessingOptions.attackSpeed": "Attack Speed Bonus: ", - - "text.autoconfig.qu-enchantments.option.agitationCurseOptions": "Agitation Curse Options", - "text.autoconfig.qu-enchantments.option.agitationCurseOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.agitationCurseOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.agitationCurseOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.agitationCurseOptions.radius": "Effect Radius: ", - - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions": "Arrow's Flight Options", - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.arrowsFlightOptions.arrowSpeed": "Arrow Speed Multiplier: ", - - "text.autoconfig.qu-enchantments.option.bashingOptions": "Bashing Options", - "text.autoconfig.qu-enchantments.option.bashingOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.bashingOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.bashingOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.bashingOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.bashingOptions.knockbackStrength": "Knockback Strength: ", - - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions": "Essence of Ender Options", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.mobTeleportDistance": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.essenceOfEnderOptions.entityTeleportDistance": "Entity Teleport Distance: ", - - "text.autoconfig.qu-enchantments.option.fidelityOptions": "Fidelity Options", - "text.autoconfig.qu-enchantments.option.fidelityOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.fidelityOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.fidelityOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.fidelityOptions.bookOffer": "Is Tradable: ", - - "text.autoconfig.qu-enchantments.option.freezingAspectOptions": "Freezing Aspect Options", - "text.autoconfig.qu-enchantments.option.freezingAspectOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.freezingAspectOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.freezingAspectOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.freezingAspectOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.freezingAspectOptions.duration": "Freeze Duration: ", - - "text.autoconfig.qu-enchantments.option.inaneAspectOptions": "Inane Aspect Options", - "text.autoconfig.qu-enchantments.option.inaneAspectOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.inaneAspectOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.inaneAspectOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.inaneAspectOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.inaneAspectOptions.duration": "Inane Duration: ", - - "text.autoconfig.qu-enchantments.option.leechingAspectOptions": "Leeching Aspect Options", - "text.autoconfig.qu-enchantments.option.leechingAspectOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.leechingAspectOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.leechingAspectOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.leechingAspectOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.leechingAspectOptions.healing": "Healing Amount: ", - - "text.autoconfig.qu-enchantments.option.lightningBoundOptions": "Lightning Bound Options", - "text.autoconfig.qu-enchantments.option.lightningBoundOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.lightningBoundOptions.randomSelection": "Spawn As Loot: ", - "text.autoconfig.qu-enchantments.option.lightningBoundOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.lightningBoundOptions.bookOffer": "Is Tradable: ", - - "text.autoconfig.qu-enchantments.option.luckyMinerOptions": "Lucky Miner Options", - "text.autoconfig.qu-enchantments.option.luckyMinerOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.luckyMinerOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.luckyMinerOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.luckyMinerOptions.bookOffer": "Is Tradable: ", - - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions": "Molten Walker Options", - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.moltenWalkerOptions.radius": "Effect Radius: ", - - "text.autoconfig.qu-enchantments.option.nightbloodOptions": "Nightblood Options", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.disablesExperience": "Disable Experience Dropping: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.witherDuration.@Tooltip": "The amount of ticks for the wither affect to apply for any entity that isn't one-hit kill.", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.witherDuration": "Wither Effect Duration: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.witherAmplifier": "Wither Effect Amplifier: ", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.drainRate.@Tooltip": "The rate at which the wielder's xp, hunger, and health will drain.", - "text.autoconfig.qu-enchantments.option.nightbloodOptions.drainRate": "Investiture Drain Rate: ", - - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions": "Omen of Immunity Options", - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.omenOfImmunityOptions.breakOnNoDurability": "Rune Breaks on No Durability: ", - - "text.autoconfig.qu-enchantments.option.reflectionOptions": "Reflection Options", - "text.autoconfig.qu-enchantments.option.reflectionOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.reflectionOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.reflectionOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.reflectionOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.reflectionOptions.divergence": "Reflection Divergence: ", - - "text.autoconfig.qu-enchantments.option.regenerationBlessingOptions": "Blessing of Regeneration Options", - "text.autoconfig.qu-enchantments.option.regenerationBlessingOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.regenerationBlessingOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.regenerationBlessingOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.regenerationBlessingOptions.bookOffer": "Is Tradable: ", - - "text.autoconfig.qu-enchantments.option.shapedGlassOptions": "Shaped Glass Options", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.damageMultiplier": "Damage Multiplier: ", - "text.autoconfig.qu-enchantments.option.shapedGlassOptions.itemDamage": "Item Damage Multiplier: ", - - "text.autoconfig.qu-enchantments.option.skywalkerOptions": "Skywalker Options", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.radius": "Radius: ", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.cloudDuration.@Tooltip": "The average duration of the cloud block in ticks.", - "text.autoconfig.qu-enchantments.option.skywalkerOptions.cloudDuration": "Cloud Duration: ", - - "text.autoconfig.qu-enchantments.option.speedBlessingOptions": "Blessing of Speed Options", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.speedBoost.@Tooltip": "REQUIRES RESTART", - "text.autoconfig.qu-enchantments.option.speedBlessingOptions.speedBoost": "Speed Boost: ", - - "text.autoconfig.qu-enchantments.option.stripMinerOptions": "Strip Miner Options", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.isEnabled": "Is Enabled: ", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.randomSelection": "Spawn as Loot: ", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.enchantingTable": "Available On Enchanting Table: ", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.bookOffer": "Is Tradable: ", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.radius.@Tooltip": "The radius of effect of the enchantment at level II.", - "text.autoconfig.qu-enchantments.option.stripMinerOptions.radius": "Radius: " + "qu-enchantments.config.title": "QuEnchantments Mod Configuration Menu", + "qu-enchantments.config.category.enchantments": "Enchantments", + "qu-enchantments.config.category.items": "Items", + + "qu-enchantments.config.general.enabled": "Is Enabled", + "qu-enchantments.config.general.enabled.desc": "If enabled, the enchantment is made available in the game.", + "qu-enchantments.config.general.randomSelection": "Can Spawn As Loot", + "qu-enchantments.config.general.randomSelection.desc": "If enabled, the enchantment can be found in chests on books or items under vanilla generation. Even with this disabled, mod specific loot generation still applies.", + "qu-enchantments.config.general.enchantingTable": "Is Available On An Enchanting Table", + "qu-enchantments.config.general.enchantingTable.desc": "If enabled, the enchantment can be acquired through an enchanting table.", + "qu-enchantments.config.general.bookOffer": "Can Be Offered By A Villager", + "qu-enchantments.config.general.bookOffer.desc": "if enabled, enchanted books with this enchantment will be purchasable from villagers.", + + "qu-enchantments.config.accuracy.group.title": "Accuracy Options", + "qu-enchantments.config.accuracy.group.desc": "Configuration options for the Accuracy Enchantment", + + "qu-enchantments.config.aggressionBlessing.group.title": "Aggression Blessing Options", + "qu-enchantments.config.aggressionBlessing.group.desc": "Configuration options for the Aggression Blessing Enchantment", + "qu-enchantments.config.aggressionBlessing.attackSpeed": "Attack Speed", + "qu-enchantments.config.aggressionBlessing.attackSpeed.desc": "The percentage reduction of the wielder's attack speed.", + + "qu-enchantments.config.agitationCurse.group.title": "Agitation Curse Options", + "qu-enchantments.config.agitationCurse.group.desc": "Configuration options for the Agitation Curse", + "qu-enchantments.config.agitationCurse.radius": "Effect Radius", + "qu-enchantments.config.agitationCurse.radius.desc": "The radius (in blocks) that this enchantment's effect will apply.", + + "qu-enchantments.config.arrowsFlight.group.title": "Arrows Flight Options", + "qu-enchantments.config.arrowsFlight.group.desc": "Configuration options for the Arrows Flight Enchantment", + "qu-enchantments.config.arrowsFlight.arrowSpeed": "Arrow Speed", + "qu-enchantments.config.arrowsFlight.arrowSpeed.desc": "How much speed the arrows shot with this enchantment applied will gain. Scales linearly with enchantment level.", + + "qu-enchantments.config.bashing.group.title": "Bashing Options", + "qu-enchantments.config.bashing.group.desc": "Configuration options for the Bashing Enchantment", + "qu-enchantments.config.bashing.knockbackStrength": "Knockback Strength", + "qu-enchantments.config.bashing.knockbackStrength.desc": "The strength of the knockback increase on the shield this enchantment is applied on.", + + "qu-enchantments.config.essenceOfEnder.group.title": "Essence Of Ender Options", + "qu-enchantments.config.essenceOfEnder.group.desc": "Configuration options for the Essence Of Ender Enchantment", + "qu-enchantments.config.essenceOfEnder.teleportDistance": "Max Teleport Distance", + "qu-enchantments.config.essenceOfEnder.teleportDistance.desc": "The maximum distance the this enchantment can teleport its wielder. Scales linearly with enchantment level.", + + "qu-enchantments.config.fidelity.group.title": "Fidelity Options", + "qu-enchantments.config.fidelity.group.desc": "Configuration options for the Fidelity Enchantment", + + "qu-enchantments.config.freezingAspect.group.title": "Freezing Aspect Options", + "qu-enchantments.config.freezingAspect.group.desc": "Configuration options for the Freezing Aspect Enchantment", + "qu-enchantments.config.freezingAspect.duration": "Freezing Effect Duration", + "qu-enchantments.config.freezingAspect.duration.desc": "The duration (in ticks) for this enchantment's freezing effect. Scales linearly with enchantment level.", + + "qu-enchantments.config.inaneAspect.group.title": "Inane Aspect Options", + "qu-enchantments.config.inaneAspect.group.desc": "Configuration options for the Inane Aspect Enchantment", + "qu-enchantments.config.inaneAspect.duration": "Inane Effect Duration", + "qu-enchantments.config.inaneAspect.duration.desc": "The duration (in ticks) for this enchantment's inane effect. Scales linearly with enchantment level.", + + "qu-enchantments.config.leechingAspect.group.title": "Leeching Aspect Options", + "qu-enchantments.config.leechingAspect.group.desc": "Configuration options for the Leeching Aspect Enchantment", + "qu-enchantments.config.leechingAspect.healing": "Healing Amount", + "qu-enchantments.config.leechingAspect.healing.desc": "The amount of healing per hit this enchantment provides. Scales linearly with enchantment level.", + + "qu-enchantments.config.lightningBound.group.title": "Lightning Bound Options", + "qu-enchantments.config.lightningBound.group.desc": "Configuration options for the Lightning Bound Enchantment", + + "qu-enchantments.config.luckyMiner.group.title": "Lucky Miner Options", + "qu-enchantments.config.luckyMiner.group.desc": "Configuration options for the Lucky Miner Enchantment", + + "qu-enchantments.config.moltenWalker.group.title": "Molten Walker Options", + "qu-enchantments.config.moltenWalker.group.desc": "Configuration options for the Molten Walker Enchantment", + "qu-enchantments.config.moltenWalker.radius": "Effect Radius", + "qu-enchantments.config.moltenWalker.radius.desc": "The radius (in blocks) that this enchantment's effect will apply.", + + "qu-enchantments.config.nightblood.group.title": "Nightblood Options", + "qu-enchantments.config.nightblood.group.desc": "Configuration options for the Nightblood Enchantment", + "qu-enchantments.config.nightblood.disablesExperience": "Disables Experience Drop", + "qu-enchantments.config.nightblood.disablesExperience.desc": "If enabled, entities killed with the strong hit of this enchantment will not drop any experience points.", + "qu-enchantments.config.nightblood.witherDuration": "Wither Effect Duration", + "qu-enchantments.config.nightblood.witherDuration.desc": "The duration (in ticks) for this enchantment's wither effect. This wither effect will only apply to entities immune to the enchantment's strong hit.", + "qu-enchantments.config.nightblood.witherAmplifier": "Wither Effect Amplifier", + "qu-enchantments.config.nightblood.witherAmplifier.desc": "The amplifier (level) of this enchantment's wither effect. This wither effect will only apply to entities immune to the enchantment's strong hit.", + "qu-enchantments.config.nightblood.drainRate": "Experience Drain Rate", + "qu-enchantments.config.nightblood.drainRate.desc": "The rate at which a wielder's experience, hunger, then health will drain when a weapon with this enchantment applied is wielded.", + + "qu-enchantments.config.omenOfImmunity.group.title": "Omen Of Immunity Options", + "qu-enchantments.config.omenOfImmunity.group.desc": "Configuration options for the Omen Of Immunity Enchantment", + "qu-enchantments.config.omenOfImmunity.breakOnNoDurability": "Break On No Durability", + "qu-enchantments.config.omenOfImmunity.breakOnNoDurability.desc": "If enabled, the rune with this enchantment will break when the durability reaches zero. This takes priority over the equivalent option in the Rune Options.", + + "qu-enchantments.config.reflection.group.title": "Reflection Options", + "qu-enchantments.config.reflection.group.desc": "Configuration options for the Reflection Enchantment", + "qu-enchantments.config.reflection.divergence": "Reflection Divergence", + "qu-enchantments.config.reflection.divergence.desc": "The divergence amount for the the projectiles reflected by this enchantment.", + + "qu-enchantments.config.regenerationBlessing.group.title": "Regeneration Blessing Options", + "qu-enchantments.config.regenerationBlessing.group.desc": "Configuration options for the Regeneration Blessing Enchantment", + + "qu-enchantments.config.shapedGlass.group.title": "Shaped Glass Options", + "qu-enchantments.config.shapedGlass.group.desc": "Configuration options for the Shaped Glass Enchantment", + "qu-enchantments.config.shapedGlass.damageMultiplier": "Damage Multiplier", + "qu-enchantments.config.shapedGlass.damageMultiplier.desc": "Affects how the damage increase of this enchantment scales with level.", + "qu-enchantments.config.shapedGlass.itemDamage": "Weapon Damage Amount", + "qu-enchantments.config.shapedGlass.itemDamage.desc": "The amount of damage a weapon with this enchantment will take upon landing a hit.", + + "qu-enchantments.config.rune.group.title": "Rune Options", + "qu-enchantments.config.rune.group.desc": "Configuration options for the Rune items", + "qu-enchantments.config.rune.breakOnNoDurability": "Non-corrupted Runes Can Break", + "qu-enchantments.config.rune.breakOnNoDurability.desc": "If enabled, even non-corrupted runes will break upon reaching zero durability.", + + "qu-enchantments.config.skywalker.group.title": "Skywalker Options", + "qu-enchantments.config.skywalker.group.desc": "Configuration options for the Skywalker Enchantment", + "qu-enchantments.config.skywalker.radius": "Effect Radius", + "qu-enchantments.config.skywalker.radius.desc": "The radius (in blocks) that this enchantment's effect will apply.", + "qu-enchantments.config.skywalker.cloudDuration": "Cloud Duration", + "qu-enchantments.config.skywalker.cloudDuration.desc": "The base duration (in ticks) for cloud blocks spawned with this enchantment. This is not the total duration, which is also possibly affected by dimension and level.", + "qu-enchantments.config.skywalker.halfUltrawarmDuration": "Ultrawarm Halves Cloud Duration", + "qu-enchantments.config.skywalker.halfUltrawarmDuration.desc": "If enabled, ultrawarm dimensions (like the Nether) halves the duration of spawned cloud blocks.", + + "qu-enchantments.config.speedBlessing.group.title": "Speed Blessing Options", + "qu-enchantments.config.speedBlessing.group.desc": "Configuration options for the Speed Blessing Enchantment", + "qu-enchantments.config.speedBlessing.speedBoost": "Speed Boost", + "qu-enchantments.config.speedBlessing.speedBoost.desc": "The amount of additional speed the wielder of this enchantment would gain.", + + "qu-enchantments.config.stripMiner.group.title": "Strip Miner Options", + "qu-enchantments.config.stripMiner.group.desc": "Configuration options for the Strip Miner Enchantment", + "qu-enchantments.config.stripMiner.radius": "Effect Radius", + "qu-enchantments.config.stripMiner.radius.desc": "The radius (in blocks) that this enchantment's level two effect will apply." } \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 4b7f797..b7b3217 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -43,7 +43,7 @@ "fabric": ">=0.97.8+1.20.5", "minecraft": ">=1.20.5", "java": ">=21", - "cloth-config": ">=14.0.126" + "yet_another_config_lib_v3": "*" }, "suggests": { "another-mod": "*"