diff --git a/defaultconfigs/1.18/config.yml b/defaultconfigs/1.18/config.yml index 5b47ec4..dd24558 100644 --- a/defaultconfigs/1.18/config.yml +++ b/defaultconfigs/1.18/config.yml @@ -97,49 +97,46 @@ default_limit: 5 # # Valid range of 1 - 255 for each enchantment enchant_limits: - aqua_affinity: 1 - binding_curse: 1 - channeling: 1 - flame: 1 - infinity: 1 - mending: 1 - multishot: 1 - silk_touch: 1 - vanishing_curse: 1 - depth_strider: 3 # anything more than 3 is treated as 3 by the game - protection: 4 - fire_protection: 4 - blast_protection: 4 - projectile_protection: 4 - feather_falling: 4 - thorns: 3 - respiration: 3 - sharpness: 5 - smite: 5 - bane_of_arthropods: 5 - knockback: 2 - fire_aspect: 2 - looting: 3 - sweeping: 3 - sweeping_edge: 3 - efficiency: 5 - unbreaking: 3 - fortune: 3 - power: 5 - punch: 2 - luck_of_the_sea: 3 - lure: 3 - frost_walker: 2 - impaling: 5 - riptide: 3 - loyalty: 3 - piercing: 4 - quick_charge: 3 - soul_speed: 3 - swift_sneak: 3 - density: 5 - breach: 4 - wind_burst: 3 + minecraft:aqua_affinity: 1 + minecraft:binding_curse: 1 + minecraft:channeling: 1 + minecraft:flame: 1 + minecraft:infinity: 1 + minecraft:mending: 1 + minecraft:multishot: 1 + minecraft:silk_touch: 1 + minecraft:vanishing_curse: 1 + minecraft:depth_strider: 3 # anything more than 3 is treated as 3 by the game + minecraft:protection: 4 + minecraft:fire_protection: 4 + minecraft:blast_protection: 4 + minecraft:projectile_protection: 4 + minecraft:feather_falling: 4 + minecraft:thorns: 3 + minecraft:respiration: 3 + minecraft:sharpness: 5 + minecraft:smite: 5 + minecraft:bane_of_arthropods: 5 + minecraft:knockback: 2 + minecraft:fire_aspect: 2 + minecraft:looting: 3 + minecraft:sweeping: 3 + minecraft:sweeping_edge: 3 + minecraft:efficiency: 5 + minecraft:unbreaking: 3 + minecraft:fortune: 3 + minecraft:power: 5 + minecraft:punch: 2 + minecraft:luck_of_the_sea: 3 + minecraft:lure: 3 + minecraft:frost_walker: 2 + minecraft:impaling: 5 + minecraft:riptide: 3 + minecraft:loyalty: 3 + minecraft:piercing: 4 + minecraft:quick_charge: 3 + minecraft:soul_speed: 3 + minecraft:swift_sneak: 3 # Multipliers used to calculate the enchantment's value in repair/combining # @@ -153,135 +150,137 @@ enchant_limits: # With default values protection 4 would have a value of 4 when # coming from either a book (4 * 1) or an item (4 * 1) enchant_values: - aqua_affinity: + minecraft:aqua_affinity: item: 4 book: 2 - bane_of_arthropods: + minecraft:bane_of_arthropods: item: 2 book: 1 - binding_curse: + minecraft:binding_curse: item: 8 book: 4 - blast_protection: + minecraft:blast_protection: item: 4 book: 2 - channeling: + minecraft:channeling: item: 8 book: 4 - depth_strider: + minecraft:depth_strider: item: 4 book: 2 - efficiency: + minecraft:efficiency: item: 1 book: 1 - flame: + minecraft:flame: item: 4 book: 2 - feather_falling: + minecraft:feather_falling: item: 2 book: 1 - fire_aspect: + minecraft:fire_aspect: item: 4 book: 2 - fire_protection: + minecraft:fire_protection: item: 2 book: 1 - fortune: + minecraft:fortune: item: 4 book: 2 - frost_walker: + minecraft:frost_walker: item: 4 book: 2 - impaling: + minecraft:impaling: item: 4 book: 2 - infinity: + minecraft:infinity: item: 8 book: 4 - knockback: + minecraft:knockback: item: 2 book: 1 - looting: + minecraft:looting: item: 4 book: 2 - loyalty: + minecraft:loyalty: item: 1 book: 1 - luck_of_the_sea: + minecraft:luck_of_the_sea: item: 4 book: 2 - lure: + minecraft:lure: item: 4 book: 2 - mending: + minecraft:mending: item: 4 book: 2 - multishot: + minecraft:multishot: item: 4 book: 2 - piercing: + minecraft:piercing: item: 1 book: 1 - power: + minecraft:power: item: 1 book: 1 - projectile_protection: + minecraft:projectile_protection: item: 2 book: 1 - protection: + minecraft:protection: item: 1 book: 1 - punch: + minecraft:punch: item: 4 book: 2 - quick_charge: + minecraft:quick_charge: item: 2 book: 1 - respiration: + minecraft:respiration: item: 4 book: 2 - riptide: + minecraft:riptide: item: 4 book: 2 - silk_touch: + minecraft:silk_touch: item: 8 book: 4 - sharpness: + minecraft:sharpness: item: 1 book: 1 - smite: + minecraft:smite: item: 2 book: 1 - soul_speed: + minecraft:soul_speed: item: 8 book: 4 - swift_sneak: + minecraft:swift_sneak: item: 8 book: 4 - sweeping: + minecraft:sweeping: item: 4 book: 2 - sweeping_edge: + minecraft:sweeping_edge: item: 4 book: 2 - thorns: + minecraft:thorns: item: 8 book: 4 - unbreaking: + minecraft:unbreaking: item: 2 book: 1 - vanishing_curse: + minecraft:vanishing_curse: item: 8 book: 4 - density: - item: 1 - book: 1 - breach: - item: 4 - book: 2 - wind_burst: - item: 4 - book: 2 + +# Disable enchantment merging for level above the set value +# Enchantment merging is when, for example, 2 unbreaking II book combine to give sharpness III +# But Enchantment above this value can still be applied. following the previous example, we could still apply a unbreaking III book to a sword +# Even if disable-merge-over of unbreaking is set to 2 +# -1 mean enchantment merge for this enchantment is not disabled. default to -1 if absent. +disable-merge-over: + # Sharpness is set to -1. it equivalent to it not being set to anything (and work as vanilla) + minecraft:sharpness: -1 + # If uncommented. 2 unbreaking II book would not give an unbreaking III book. but unbreaking III book can still be applied + #minecraft:unbreaking: 2 # Whether to show debug logging debug_log: false @@ -296,4 +295,3 @@ debug_log_verbose: false force_protocolib: false configVersion: 1.6.2 -lowMinecraftVersion: '1.21' diff --git a/defaultconfigs/1.18/enchant_conflict.yml b/defaultconfigs/1.18/enchant_conflict.yml index ed154ab..0e8b3f3 100644 --- a/defaultconfigs/1.18/enchant_conflict.yml +++ b/defaultconfigs/1.18/enchant_conflict.yml @@ -17,158 +17,158 @@ # ---------------------------------------------------- restriction_aqua_affinity: - enchantments: [ aqua_affinity ] + enchantments: [ minecraft:aqua_affinity ] notAffectedGroups: [ enchanted_book, helmets ] restriction_bane_of_arthropods: - enchantments: [ bane_of_arthropods ] + enchantments: [ minecraft:bane_of_arthropods ] notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_blast_protection: - enchantments: [ blast_protection ] + enchantments: [ minecraft:blast_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_channeling: - enchantments: [ channeling ] + enchantments: [ minecraft:channeling ] notAffectedGroups: [ enchanted_book, trident ] restriction_binding_curse: - enchantments: [ binding_curse ] + enchantments: [ minecraft:binding_curse ] notAffectedGroups: [ enchanted_book, wearable ] restriction_vanishing_curse: - enchantments: [ vanishing_curse ] + enchantments: [ minecraft:vanishing_curse ] notAffectedGroups: [ enchanted_book, can_vanish ] restriction_depth_strider: - enchantments: [ depth_strider ] + enchantments: [ minecraft:depth_strider ] notAffectedGroups: [ enchanted_book, boots ] restriction_efficiency: - enchantments: [ efficiency ] + enchantments: [ minecraft:efficiency ] notAffectedGroups: [ enchanted_book, tools, shears ] restriction_feather_falling: - enchantments: [ feather_falling ] + enchantments: [ minecraft:feather_falling ] notAffectedGroups: [ enchanted_book, boots ] restriction_fire_aspect: - enchantments: [ fire_aspect ] + enchantments: [ minecraft:fire_aspect ] notAffectedGroups: [ enchanted_book, swords ] restriction_fire_protection: - enchantments: [ fire_protection ] + enchantments: [ minecraft:fire_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_flame: - enchantments: [ flame ] + enchantments: [ minecraft:flame ] notAffectedGroups: [ enchanted_book, bow ] restriction_fortune: - enchantments: [ fortune ] + enchantments: [ minecraft:fortune ] notAffectedGroups: [ enchanted_book, tools ] restriction_frost_walker: - enchantments: [ frost_walker ] + enchantments: [ minecraft:frost_walker ] notAffectedGroups: [ enchanted_book, boots ] restriction_impaling: - enchantments: [ impaling ] + enchantments: [ minecraft:impaling ] notAffectedGroups: [ enchanted_book, trident ] restriction_infinity: - enchantments: [ infinity ] + enchantments: [ minecraft:infinity ] notAffectedGroups: [ enchanted_book, bow ] restriction_knockback: - enchantments: [ knockback ] + enchantments: [ minecraft:knockback ] notAffectedGroups: [ enchanted_book, swords ] restriction_looting: - enchantments: [ looting ] + enchantments: [ minecraft:looting ] notAffectedGroups: [ enchanted_book, swords ] restriction_loyalty: - enchantments: [ loyalty ] + enchantments: [ minecraft:loyalty ] notAffectedGroups: [ enchanted_book, trident ] restriction_lure: - enchantments: [ lure ] + enchantments: [ minecraft:lure ] notAffectedGroups: [ enchanted_book, fishing_rod ] restriction_mending: - enchantments: [ mending ] + enchantments: [ minecraft:mending ] notAffectedGroups: [ enchanted_book, can_unbreak ] -restriction_multishot: - enchantments: [ multishot ] +restriction_minecraft_multishot: + enchantments: [ minecraft:multishot ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_piercing: - enchantments: [ piercing ] + enchantments: [ minecraft:piercing ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_power: - enchantments: [ power ] + enchantments: [ minecraft:power ] notAffectedGroups: [ enchanted_book, bow ] restriction_projectile_protection: - enchantments: [ projectile_protection ] + enchantments: [ minecraft:projectile_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_protection: - enchantments: [ protection ] + enchantments: [ minecraft:protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_punch: - enchantments: [ punch ] + enchantments: [ minecraft:punch ] notAffectedGroups: [ enchanted_book, bow ] restriction_quick_charge: - enchantments: [ quick_charge ] + enchantments: [ minecraft:quick_charge ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_respiration: - enchantments: [ respiration ] + enchantments: [ minecraft:respiration ] notAffectedGroups: [ enchanted_book, helmets ] restriction_riptide: - enchantments: [ riptide ] + enchantments: [ minecraft:riptide ] notAffectedGroups: [ enchanted_book, trident ] restriction_sharpness: - enchantments: [ sharpness ] + enchantments: [ minecraft:sharpness ] notAffectedGroups: [ enchanted_book, melee_weapons ] -restriction_silk_touch: - enchantments: [ silk_touch ] +restriction__silk_touch: + enchantments: [ minecraft:silk_touch ] notAffectedGroups: [ enchanted_book, tools ] restriction_smite: - enchantments: [ smite ] + enchantments: [ minecraft:smite ] notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_soul_speed: - enchantments: [ soul_speed ] + enchantments: [ minecraft:soul_speed ] notAffectedGroups: [ enchanted_book, boots ] restriction_sweeping_edge: - enchantments: [ sweeping, sweeping_edge ] + enchantments: [ minecraft:sweeping, minecraft:sweeping_edge ] notAffectedGroups: [ enchanted_book, swords ] # Do not exist in 1.18, that mean useInFuture will be set to true # useInFuture set to true also mean it will not warn if there is an issue restriction_swift_sneak: useInFuture: true - enchantments: [ swift_sneak ] + enchantments: [ minecraft:swift_sneak ] notAffectedGroups: [ enchanted_book, leggings ] restriction_thorns: - enchantments: [ thorns ] + enchantments: [ minecraft:thorns ] notAffectedGroups: [ enchanted_book, armors ] -restriction_unbreaking: - enchantments: [ unbreaking ] +restriction__unbreaking: + enchantments: [ minecraft:unbreaking ] notAffectedGroups: [ enchanted_book, can_unbreak ] # ---------------------------------------------------- @@ -180,60 +180,60 @@ restriction_unbreaking: sword_enchant_conflict: enchantments: - - bane_of_arthropods - - smite - - sharpness + - minecraft:bane_of_arthropods + - minecraft:smite + - minecraft:sharpness notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 protection_enchant_conflict: enchantments: - - blast_protection - - fire_protection - - projectile_protection - - protection + - minecraft:blast_protection + - minecraft:fire_protection + - minecraft:projectile_protection + - minecraft:protection notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict1: enchantments: - - channeling - - riptide + - minecraft:channeling + - minecraft:riptide notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict2: enchantments: - - loyalty - - riptide + - minecraft:loyalty + - minecraft:riptide notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 boot_conflict: enchantments: - - depth_strider - - frost_walker + - minecraft:depth_strider + - minecraft:frost_walker notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 tool_conflict: enchantments: - - fortune - - silk_touch + - minecraft:fortune + - minecraft:silk_touch notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 bow_conflict: enchantments: - - mending - - infinity + - minecraft:mending + - minecraft:infinity notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 crossbow_conflict: enchantments: - - multishot - - piercing + - minecraft:multishot + - minecraft:piercing notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 diff --git a/defaultconfigs/1.21/config.yml b/defaultconfigs/1.21/config.yml index 5b47ec4..dd24558 100644 --- a/defaultconfigs/1.21/config.yml +++ b/defaultconfigs/1.21/config.yml @@ -97,49 +97,46 @@ default_limit: 5 # # Valid range of 1 - 255 for each enchantment enchant_limits: - aqua_affinity: 1 - binding_curse: 1 - channeling: 1 - flame: 1 - infinity: 1 - mending: 1 - multishot: 1 - silk_touch: 1 - vanishing_curse: 1 - depth_strider: 3 # anything more than 3 is treated as 3 by the game - protection: 4 - fire_protection: 4 - blast_protection: 4 - projectile_protection: 4 - feather_falling: 4 - thorns: 3 - respiration: 3 - sharpness: 5 - smite: 5 - bane_of_arthropods: 5 - knockback: 2 - fire_aspect: 2 - looting: 3 - sweeping: 3 - sweeping_edge: 3 - efficiency: 5 - unbreaking: 3 - fortune: 3 - power: 5 - punch: 2 - luck_of_the_sea: 3 - lure: 3 - frost_walker: 2 - impaling: 5 - riptide: 3 - loyalty: 3 - piercing: 4 - quick_charge: 3 - soul_speed: 3 - swift_sneak: 3 - density: 5 - breach: 4 - wind_burst: 3 + minecraft:aqua_affinity: 1 + minecraft:binding_curse: 1 + minecraft:channeling: 1 + minecraft:flame: 1 + minecraft:infinity: 1 + minecraft:mending: 1 + minecraft:multishot: 1 + minecraft:silk_touch: 1 + minecraft:vanishing_curse: 1 + minecraft:depth_strider: 3 # anything more than 3 is treated as 3 by the game + minecraft:protection: 4 + minecraft:fire_protection: 4 + minecraft:blast_protection: 4 + minecraft:projectile_protection: 4 + minecraft:feather_falling: 4 + minecraft:thorns: 3 + minecraft:respiration: 3 + minecraft:sharpness: 5 + minecraft:smite: 5 + minecraft:bane_of_arthropods: 5 + minecraft:knockback: 2 + minecraft:fire_aspect: 2 + minecraft:looting: 3 + minecraft:sweeping: 3 + minecraft:sweeping_edge: 3 + minecraft:efficiency: 5 + minecraft:unbreaking: 3 + minecraft:fortune: 3 + minecraft:power: 5 + minecraft:punch: 2 + minecraft:luck_of_the_sea: 3 + minecraft:lure: 3 + minecraft:frost_walker: 2 + minecraft:impaling: 5 + minecraft:riptide: 3 + minecraft:loyalty: 3 + minecraft:piercing: 4 + minecraft:quick_charge: 3 + minecraft:soul_speed: 3 + minecraft:swift_sneak: 3 # Multipliers used to calculate the enchantment's value in repair/combining # @@ -153,135 +150,137 @@ enchant_limits: # With default values protection 4 would have a value of 4 when # coming from either a book (4 * 1) or an item (4 * 1) enchant_values: - aqua_affinity: + minecraft:aqua_affinity: item: 4 book: 2 - bane_of_arthropods: + minecraft:bane_of_arthropods: item: 2 book: 1 - binding_curse: + minecraft:binding_curse: item: 8 book: 4 - blast_protection: + minecraft:blast_protection: item: 4 book: 2 - channeling: + minecraft:channeling: item: 8 book: 4 - depth_strider: + minecraft:depth_strider: item: 4 book: 2 - efficiency: + minecraft:efficiency: item: 1 book: 1 - flame: + minecraft:flame: item: 4 book: 2 - feather_falling: + minecraft:feather_falling: item: 2 book: 1 - fire_aspect: + minecraft:fire_aspect: item: 4 book: 2 - fire_protection: + minecraft:fire_protection: item: 2 book: 1 - fortune: + minecraft:fortune: item: 4 book: 2 - frost_walker: + minecraft:frost_walker: item: 4 book: 2 - impaling: + minecraft:impaling: item: 4 book: 2 - infinity: + minecraft:infinity: item: 8 book: 4 - knockback: + minecraft:knockback: item: 2 book: 1 - looting: + minecraft:looting: item: 4 book: 2 - loyalty: + minecraft:loyalty: item: 1 book: 1 - luck_of_the_sea: + minecraft:luck_of_the_sea: item: 4 book: 2 - lure: + minecraft:lure: item: 4 book: 2 - mending: + minecraft:mending: item: 4 book: 2 - multishot: + minecraft:multishot: item: 4 book: 2 - piercing: + minecraft:piercing: item: 1 book: 1 - power: + minecraft:power: item: 1 book: 1 - projectile_protection: + minecraft:projectile_protection: item: 2 book: 1 - protection: + minecraft:protection: item: 1 book: 1 - punch: + minecraft:punch: item: 4 book: 2 - quick_charge: + minecraft:quick_charge: item: 2 book: 1 - respiration: + minecraft:respiration: item: 4 book: 2 - riptide: + minecraft:riptide: item: 4 book: 2 - silk_touch: + minecraft:silk_touch: item: 8 book: 4 - sharpness: + minecraft:sharpness: item: 1 book: 1 - smite: + minecraft:smite: item: 2 book: 1 - soul_speed: + minecraft:soul_speed: item: 8 book: 4 - swift_sneak: + minecraft:swift_sneak: item: 8 book: 4 - sweeping: + minecraft:sweeping: item: 4 book: 2 - sweeping_edge: + minecraft:sweeping_edge: item: 4 book: 2 - thorns: + minecraft:thorns: item: 8 book: 4 - unbreaking: + minecraft:unbreaking: item: 2 book: 1 - vanishing_curse: + minecraft:vanishing_curse: item: 8 book: 4 - density: - item: 1 - book: 1 - breach: - item: 4 - book: 2 - wind_burst: - item: 4 - book: 2 + +# Disable enchantment merging for level above the set value +# Enchantment merging is when, for example, 2 unbreaking II book combine to give sharpness III +# But Enchantment above this value can still be applied. following the previous example, we could still apply a unbreaking III book to a sword +# Even if disable-merge-over of unbreaking is set to 2 +# -1 mean enchantment merge for this enchantment is not disabled. default to -1 if absent. +disable-merge-over: + # Sharpness is set to -1. it equivalent to it not being set to anything (and work as vanilla) + minecraft:sharpness: -1 + # If uncommented. 2 unbreaking II book would not give an unbreaking III book. but unbreaking III book can still be applied + #minecraft:unbreaking: 2 # Whether to show debug logging debug_log: false @@ -296,4 +295,3 @@ debug_log_verbose: false force_protocolib: false configVersion: 1.6.2 -lowMinecraftVersion: '1.21' diff --git a/defaultconfigs/1.21/enchant_conflict.yml b/defaultconfigs/1.21/enchant_conflict.yml index dc3e951..0e8b3f3 100644 --- a/defaultconfigs/1.21/enchant_conflict.yml +++ b/defaultconfigs/1.21/enchant_conflict.yml @@ -17,278 +17,159 @@ # ---------------------------------------------------- restriction_aqua_affinity: - enchantments: - - aqua_affinity - notAffectedGroups: - - enchanted_book - - helmets + enchantments: [ minecraft:aqua_affinity ] + notAffectedGroups: [ enchanted_book, helmets ] restriction_bane_of_arthropods: - enchantments: - - bane_of_arthropods - notAffectedGroups: - - enchanted_book - - melee_weapons - - mace + enchantments: [ minecraft:bane_of_arthropods ] + notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_blast_protection: - enchantments: - - blast_protection - notAffectedGroups: - - enchanted_book - - armors + enchantments: [ minecraft:blast_protection ] + notAffectedGroups: [ enchanted_book, armors ] restriction_channeling: - enchantments: - - channeling - notAffectedGroups: - - enchanted_book - - trident + enchantments: [ minecraft:channeling ] + notAffectedGroups: [ enchanted_book, trident ] restriction_binding_curse: - enchantments: - - binding_curse - notAffectedGroups: - - enchanted_book - - wearable + enchantments: [ minecraft:binding_curse ] + notAffectedGroups: [ enchanted_book, wearable ] restriction_vanishing_curse: - enchantments: - - vanishing_curse - notAffectedGroups: - - enchanted_book - - can_vanish + enchantments: [ minecraft:vanishing_curse ] + notAffectedGroups: [ enchanted_book, can_vanish ] restriction_depth_strider: - enchantments: - - depth_strider - notAffectedGroups: - - enchanted_book - - boots + enchantments: [ minecraft:depth_strider ] + notAffectedGroups: [ enchanted_book, boots ] restriction_efficiency: - enchantments: - - efficiency - notAffectedGroups: - - enchanted_book - - tools - - shears + enchantments: [ minecraft:efficiency ] + notAffectedGroups: [ enchanted_book, tools, shears ] restriction_feather_falling: - enchantments: - - feather_falling - notAffectedGroups: - - enchanted_book - - boots + enchantments: [ minecraft:feather_falling ] + notAffectedGroups: [ enchanted_book, boots ] restriction_fire_aspect: - enchantments: - - fire_aspect - notAffectedGroups: - - enchanted_book - - swords - - mace + enchantments: [ minecraft:fire_aspect ] + notAffectedGroups: [ enchanted_book, swords ] restriction_fire_protection: - enchantments: - - fire_protection - notAffectedGroups: - - enchanted_book - - armors + enchantments: [ minecraft:fire_protection ] + notAffectedGroups: [ enchanted_book, armors ] restriction_flame: - enchantments: - - flame - notAffectedGroups: - - enchanted_book - - bow + enchantments: [ minecraft:flame ] + notAffectedGroups: [ enchanted_book, bow ] restriction_fortune: - enchantments: - - fortune - notAffectedGroups: - - enchanted_book - - tools + enchantments: [ minecraft:fortune ] + notAffectedGroups: [ enchanted_book, tools ] restriction_frost_walker: - enchantments: - - frost_walker - notAffectedGroups: - - enchanted_book - - boots + enchantments: [ minecraft:frost_walker ] + notAffectedGroups: [ enchanted_book, boots ] restriction_impaling: - enchantments: - - impaling - notAffectedGroups: - - enchanted_book - - trident + enchantments: [ minecraft:impaling ] + notAffectedGroups: [ enchanted_book, trident ] restriction_infinity: - enchantments: - - infinity - notAffectedGroups: - - enchanted_book - - bow + enchantments: [ minecraft:infinity ] + notAffectedGroups: [ enchanted_book, bow ] restriction_knockback: - enchantments: - - knockback - notAffectedGroups: - - enchanted_book - - swords + enchantments: [ minecraft:knockback ] + notAffectedGroups: [ enchanted_book, swords ] restriction_looting: - enchantments: - - looting - notAffectedGroups: - - enchanted_book - - swords + enchantments: [ minecraft:looting ] + notAffectedGroups: [ enchanted_book, swords ] restriction_loyalty: - enchantments: - - loyalty - notAffectedGroups: - - enchanted_book - - trident + enchantments: [ minecraft:loyalty ] + notAffectedGroups: [ enchanted_book, trident ] restriction_lure: - enchantments: - - lure - notAffectedGroups: - - enchanted_book - - fishing_rod + enchantments: [ minecraft:lure ] + notAffectedGroups: [ enchanted_book, fishing_rod ] restriction_mending: - enchantments: - - mending - notAffectedGroups: - - enchanted_book - - can_unbreak + enchantments: [ minecraft:mending ] + notAffectedGroups: [ enchanted_book, can_unbreak ] -restriction_multishot: - enchantments: - - multishot - notAffectedGroups: - - enchanted_book - - crossbow +restriction_minecraft_multishot: + enchantments: [ minecraft:multishot ] + notAffectedGroups: [ enchanted_book, crossbow ] restriction_piercing: - enchantments: - - piercing - notAffectedGroups: - - enchanted_book - - crossbow + enchantments: [ minecraft:piercing ] + notAffectedGroups: [ enchanted_book, crossbow ] restriction_power: - enchantments: - - power - notAffectedGroups: - - enchanted_book - - bow + enchantments: [ minecraft:power ] + notAffectedGroups: [ enchanted_book, bow ] restriction_projectile_protection: - enchantments: - - projectile_protection - notAffectedGroups: - - enchanted_book - - armors + enchantments: [ minecraft:projectile_protection ] + notAffectedGroups: [ enchanted_book, armors ] restriction_protection: - enchantments: - - protection - notAffectedGroups: - - enchanted_book - - armors + enchantments: [ minecraft:protection ] + notAffectedGroups: [ enchanted_book, armors ] restriction_punch: - enchantments: - - punch - notAffectedGroups: - - enchanted_book - - bow + enchantments: [ minecraft:punch ] + notAffectedGroups: [ enchanted_book, bow ] restriction_quick_charge: - enchantments: - - quick_charge - notAffectedGroups: - - enchanted_book - - crossbow + enchantments: [ minecraft:quick_charge ] + notAffectedGroups: [ enchanted_book, crossbow ] restriction_respiration: - enchantments: - - respiration - notAffectedGroups: - - enchanted_book - - helmets + enchantments: [ minecraft:respiration ] + notAffectedGroups: [ enchanted_book, helmets ] restriction_riptide: - enchantments: - - riptide - notAffectedGroups: - - enchanted_book - - trident + enchantments: [ minecraft:riptide ] + notAffectedGroups: [ enchanted_book, trident ] restriction_sharpness: - enchantments: - - sharpness - notAffectedGroups: - - enchanted_book - - melee_weapons + enchantments: [ minecraft:sharpness ] + notAffectedGroups: [ enchanted_book, melee_weapons ] -restriction_silk_touch: - enchantments: - - silk_touch - notAffectedGroups: - - enchanted_book - - tools +restriction__silk_touch: + enchantments: [ minecraft:silk_touch ] + notAffectedGroups: [ enchanted_book, tools ] restriction_smite: - enchantments: - - smite - notAffectedGroups: - - enchanted_book - - melee_weapons - - mace + enchantments: [ minecraft:smite ] + notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_soul_speed: - enchantments: - - soul_speed - notAffectedGroups: - - enchanted_book - - boots + enchantments: [ minecraft:soul_speed ] + notAffectedGroups: [ enchanted_book, boots ] restriction_sweeping_edge: - enchantments: - - sweeping - - sweeping_edge - notAffectedGroups: - - enchanted_book - - swords + enchantments: [ minecraft:sweeping, minecraft:sweeping_edge ] + notAffectedGroups: [ enchanted_book, swords ] # Do not exist in 1.18, that mean useInFuture will be set to true # useInFuture set to true also mean it will not warn if there is an issue restriction_swift_sneak: useInFuture: true - enchantments: - - swift_sneak - notAffectedGroups: - - enchanted_book - - leggings + enchantments: [ minecraft:swift_sneak ] + notAffectedGroups: [ enchanted_book, leggings ] restriction_thorns: - enchantments: - - thorns - notAffectedGroups: - - enchanted_book - - armors + enchantments: [ minecraft:thorns ] + notAffectedGroups: [ enchanted_book, armors ] -restriction_unbreaking: - enchantments: - - unbreaking - notAffectedGroups: - - enchanted_book - - can_unbreak +restriction__unbreaking: + enchantments: [ minecraft:unbreaking ] + notAffectedGroups: [ enchanted_book, can_unbreak ] # ---------------------------------------------------- # Now we have conflicts about enchantment Incompatibility @@ -299,86 +180,61 @@ restriction_unbreaking: sword_enchant_conflict: enchantments: - - bane_of_arthropods - - smite - - sharpness - notAffectedGroups: [] + - minecraft:bane_of_arthropods + - minecraft:smite + - minecraft:sharpness + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 protection_enchant_conflict: enchantments: - - blast_protection - - fire_protection - - projectile_protection - - protection - notAffectedGroups: [] + - minecraft:blast_protection + - minecraft:fire_protection + - minecraft:projectile_protection + - minecraft:protection + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict1: enchantments: - - channeling - - riptide - notAffectedGroups: [] + - minecraft:channeling + - minecraft:riptide + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict2: enchantments: - - loyalty - - riptide - notAffectedGroups: [] + - minecraft:loyalty + - minecraft:riptide + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 boot_conflict: enchantments: - - depth_strider - - frost_walker - notAffectedGroups: [] + - minecraft:depth_strider + - minecraft:frost_walker + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 tool_conflict: enchantments: - - fortune - - silk_touch - notAffectedGroups: [] + - minecraft:fortune + - minecraft:silk_touch + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 bow_conflict: enchantments: - - mending - - infinity - notAffectedGroups: [] + - minecraft:mending + - minecraft:infinity + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 crossbow_conflict: enchantments: - - multishot - - piercing - notAffectedGroups: [] - maxEnchantmentBeforeConflict: 1 -restriction_density: - enchantments: - - density - notAffectedGroups: - - mace - - enchanted_book -restriction_breach: - enchantments: - - breach - notAffectedGroups: - - mace - - enchanted_book -restriction_wind_burst: - enchantments: - - wind_burst - notAffectedGroups: - - mace - - enchanted_book -mace_enchant_conflict: - enchantments: - - density - - breach - - smite - - bane_of_arthropods + - minecraft:multishot + - minecraft:piercing + notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 # ---------------------------------------------------- diff --git a/defaultconfigs/1.21/item_groups.yml b/defaultconfigs/1.21/item_groups.yml index 0add107..3c1eb5d 100644 --- a/defaultconfigs/1.21/item_groups.yml +++ b/defaultconfigs/1.21/item_groups.yml @@ -20,16 +20,16 @@ nothing: example_include: type: include items: - - stone - - polished_granite + - stone + - polished_granite # This group contain everything except polished granite and elements of example_include example_exclude: type: exclude items: - - polished_granite + - polished_granite groups: - - example_include + - example_include # Default configuration should be vanilla enchantment conflict group # there may have error, if you find one you can fix it ! @@ -38,176 +38,173 @@ example_exclude: swords: type: include items: - - wooden_sword - - stone_sword - - iron_sword - - diamond_sword - - golden_sword - - netherite_sword + - wooden_sword + - stone_sword + - iron_sword + - diamond_sword + - golden_sword + - netherite_sword axes: type: include items: - - wooden_axe - - stone_axe - - iron_axe - - diamond_axe - - golden_axe - - netherite_axe + - wooden_axe + - stone_axe + - iron_axe + - diamond_axe + - golden_axe + - netherite_axe melee_weapons: type: include groups: - - swords - - axes + - swords + - axes helmets: type: include items: - - leather_helmet - - chainmail_helmet - - iron_helmet - - diamond_helmet - - golden_helmet - - netherite_helmet - - turtle_helmet + - leather_helmet + - chainmail_helmet + - iron_helmet + - diamond_helmet + - golden_helmet + - netherite_helmet + - turtle_helmet chestplate: type: include items: - - leather_chestplate - - chainmail_chestplate - - iron_chestplate - - diamond_chestplate - - golden_chestplate - - netherite_chestplate + - leather_chestplate + - chainmail_chestplate + - iron_chestplate + - diamond_chestplate + - golden_chestplate + - netherite_chestplate leggings: type: include items: - - leather_leggings - - chainmail_leggings - - iron_leggings - - diamond_leggings - - golden_leggings - - netherite_leggings + - leather_leggings + - chainmail_leggings + - iron_leggings + - diamond_leggings + - golden_leggings + - netherite_leggings boots: type: include items: - - leather_boots - - chainmail_boots - - iron_boots - - diamond_boots - - golden_boots - - netherite_boots + - leather_boots + - chainmail_boots + - iron_boots + - diamond_boots + - golden_boots + - netherite_boots armors: type: include groups: - - helmets - - chestplate - - leggings - - boots + - helmets + - chestplate + - leggings + - boots wearable: type: include items: - - elytra - - carved_pumpkin - - skeleton_skull - - wither_skeleton_skull - - zombie_head - - player_head - - creeper_head - - dragon_head - - piglin_head + - elytra + - carved_pumpkin + - skeleton_skull + - wither_skeleton_skull + - zombie_head + - player_head + - creeper_head + - dragon_head + # do not exist in 1.18 but exist in future update + - piglin_head groups: - - armors + - armors tools: type: include items: - - wooden_pickaxe - - stone_pickaxe - - iron_pickaxe - - diamond_pickaxe - - golden_pickaxe - - netherite_pickaxe - - wooden_shovel - - stone_shovel - - iron_shovel - - diamond_shovel - - golden_shovel - - netherite_shovel - - wooden_hoe - - stone_hoe - - iron_hoe - - diamond_hoe - - golden_hoe - - netherite_hoe + - wooden_pickaxe + - stone_pickaxe + - iron_pickaxe + - diamond_pickaxe + - golden_pickaxe + - netherite_pickaxe + - wooden_shovel + - stone_shovel + - iron_shovel + - diamond_shovel + - golden_shovel + - netherite_shovel + - wooden_hoe + - stone_hoe + - iron_hoe + - diamond_hoe + - golden_hoe + - netherite_hoe groups: - - axes + - axes enchanted_book: type: include items: - - enchanted_book + - enchanted_book trident: type: include items: - - trident + - trident bow: type: include items: - - bow + - bow crossbow: type: include items: - - crossbow + - crossbow fishing_rod: type: include items: - - fishing_rod + - fishing_rod shears: type: include items: - - shears + - shears can_unbreak: type: include items: - - elytra - - flint_and_steel - - shield - - carrot_on_a_stick - - warped_fungus_on_a_stick - - brush + - elytra + - flint_and_steel + - shield + - carrot_on_a_stick + - warped_fungus_on_a_stick + # do not exist in 1.18 but exist in future update + - brush groups: - - melee_weapons - - tools - - armors - - trident - - bow - - crossbow - - fishing_rod - - shears - - mace + - melee_weapons + - tools + - armors + - trident + - bow + - crossbow + - fishing_rod + - shears can_vanish: type: include items: - - compass + - compass groups: - - wearable - - can_unbreak -mace: - type: include - items: - - mace + - wearable + - can_unbreak diff --git a/defaultconfigs/1.21/unit_repair_item.yml b/defaultconfigs/1.21/unit_repair_item.yml index ec548c6..2902cce 100644 --- a/defaultconfigs/1.21/unit_repair_item.yml +++ b/defaultconfigs/1.21/unit_repair_item.yml @@ -188,5 +188,3 @@ warped_planks: wooden_shovel: 0.25 wooden_hoe: 0.25 shield: 0.25 -breeze_rod: - mace: 0.25 diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java index ad01827..8047382 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictAPI.java @@ -119,7 +119,7 @@ public class ConflictAPI { private static List extractEnchantments(@NotNull ConflictBuilder builder){ List result = new ArrayList<>(builder.getEnchantmentNames()); for (NamespacedKey enchantmentKey : builder.getEnchantmentKeys()) { - result.add(enchantmentKey.getKey()); + result.add(enchantmentKey.toString()); } return result; diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java index 3e63b36..e3fd2d6 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/ConflictBuilder.java @@ -10,6 +10,7 @@ import xyz.alexcrea.cuanvil.enchant.CAEnchantment; import xyz.alexcrea.cuanvil.group.*; import java.util.HashSet; +import java.util.List; import java.util.Set; /** @@ -372,7 +373,7 @@ public class ConflictBuilder { */ protected void appendEnchantments(@NotNull EnchantConflictGroup conflict){ for (String enchantmentName : getEnchantmentNames()){ - if(appendEnchantment(conflict, EnchantmentApi.getByName(enchantmentName))){ + if(appendEnchantments(conflict, EnchantmentApi.getListByName(enchantmentName)) == 0){ CustomAnvil.instance.getLogger().warning("Could not find enchantment " + enchantmentName + " for conflict " + getName()); ConflictAPI.logConflictOrigin(this); } @@ -399,6 +400,24 @@ public class ConflictBuilder { return true; } + /** + * Append a list of enchantments. + * + * @param conflict The conflict target + * @param enchantments List of enchantment to add + * @return Number of enchantment added + */ + protected static int appendEnchantments(@NotNull EnchantConflictGroup conflict, @NotNull List enchantments){ + int numberValid = 0; + for (CAEnchantment enchantment : enchantments) { + if(appendEnchantment(conflict, enchantment)){ + numberValid++; + } + } + + return numberValid; + } + /** * Extract group abstract material group. * diff --git a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java index 01c5ed8..32a62c3 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java +++ b/src/main/java/xyz/alexcrea/cuanvil/api/EnchantmentApi.java @@ -18,6 +18,7 @@ import xyz.alexcrea.cuanvil.gui.config.global.EnchantCostConfigGui; import xyz.alexcrea.cuanvil.gui.config.global.EnchantLimitConfigGui; import java.util.Collections; +import java.util.List; import java.util.Map; /** @@ -104,7 +105,7 @@ public class EnchantmentApi { * @return True if successful. */ public static boolean unregisterEnchantment(@NotNull NamespacedKey key){ - CAEnchantment enchantment = CAEnchantmentRegistry.getInstance().getByKey(key); + CAEnchantment enchantment = CAEnchantment.getByKey(key); return unregisterEnchantment(enchantment); } @@ -126,7 +127,7 @@ public class EnchantmentApi { */ @Nullable public static CAEnchantment getByKey(@NotNull NamespacedKey key){ - return CAEnchantmentRegistry.getInstance().getByKey(key); + return CAEnchantment.getByKey(key); } /** @@ -134,10 +135,22 @@ public class EnchantmentApi { * * @param name The name used to fetch * @return The custom anvil enchantment of this name. null if not found. + * @deprecated use {@link #getListByName(String)} */ + @Deprecated(since = "1.6.3") @Nullable public static CAEnchantment getByName(@NotNull String name){ - return CAEnchantmentRegistry.getInstance().getByName(name); + return CAEnchantment.getByName(name); + } + + /** + * Get list of enchantment using the provided name. + * + * @param name The name used to fetch + * @return List of custom anvil enchantments of this name. May be empty if not found. + */ + public static List getListByName(@NotNull String name){ + return CAEnchantment.getListByName(name); } /** @@ -167,9 +180,9 @@ public class EnchantmentApi { private static void writeDefaultConfig(FileConfiguration defaultConfig, CAEnchantment enchantment) { - defaultConfig.set("enchant_limits." + enchantment.getKey().getKey(), enchantment.defaultMaxLevel()); + defaultConfig.set("enchant_limits." + enchantment.getKey(), enchantment.defaultMaxLevel()); - String basePath = "enchant_values." + enchantment.getKey().getKey(); + String basePath = "enchant_values." + enchantment.getKey(); EnchantmentRarity rarity = enchantment.defaultRarity(); defaultConfig.set(basePath + ".item", rarity.getItemValue()); diff --git a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java index 0303733..1d94ba2 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java +++ b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantment.java @@ -12,6 +12,7 @@ import xyz.alexcrea.cuanvil.group.EnchantConflictGroup; import java.util.Collection; import java.util.HashMap; +import java.util.List; import java.util.Map; /** @@ -226,12 +227,24 @@ public interface CAEnchantment { } /** - * Gets a list of all the unoptimised enchantments. - * @param name The enchantment name - * @return List of enchantment. + * Gets the enchantment by the provided name. + * @param name Name to fetch. + * @return Registered enchantment. null if absent. + * + * @deprecated use {@link #getListByName(String)} */ + @Deprecated(since = "1.6.3") static @Nullable CAEnchantment getByName(@NotNull String name){ return CAEnchantmentRegistry.getInstance().getByName(name); } + /** + * Gets list of enchantment using the provided name. + * @param name Name to fetch. + * @return List of registered enchantment. + */ + static List getListByName(@NotNull String name){ + return CAEnchantmentRegistry.getInstance().getListByName(name); + } + } diff --git a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java index 01262f9..1225209 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java +++ b/src/main/java/xyz/alexcrea/cuanvil/enchant/CAEnchantmentRegistry.java @@ -22,7 +22,7 @@ public class CAEnchantmentRegistry { // Register enchantment functions private final HashMap byKeyMap; - private final HashMap byNameMap; + private final HashMap> byNameMap; private final SortedSet nameSortedEnchantments; @@ -62,6 +62,8 @@ public class CAEnchantmentRegistry { } + private static boolean hasWarnedRegistering = false; + /** * Can be used to register new enchantment. *

@@ -73,19 +75,25 @@ public class CAEnchantmentRegistry { public boolean register(@NotNull CAEnchantment enchantment){ if(byKeyMap.containsKey(enchantment.getKey())){ CustomAnvil.instance.getLogger().log(Level.WARNING, - "Duplicate registered enchantment. This should NOT happen.", + "Duplicate registered enchantment. This should NOT happen any time.\n" + + "If you are a custom anvil developer. You maybe custom anvil detected your enchantment as a bukkit enchantment. " + + "maybe remove enchantment with the same key before registering yours", new IllegalStateException(enchantment.getKey()+" enchantment was already registered")); return false; } - if(byNameMap.containsKey(enchantment.getName())){ + + if((!hasWarnedRegistering) && byNameMap.containsKey(enchantment.getName())){ + hasWarnedRegistering = true; + CustomAnvil.instance.getLogger().log(Level.WARNING, - "Duplicate registered enchantment name. There will have issue. " + - "\nI hope this do not happen to you on a production server. If it do, there is probably a plugin trying to register an enchantment with the same name than another one", - new IllegalStateException(enchantment.getKey()+" enchantment name was already registered")); + "Duplicate registered enchantment name. Please check that configuration is using namespace."); } byKeyMap.put(enchantment.getKey(), enchantment); - byNameMap.put(enchantment.getName(), enchantment); + + byNameMap.putIfAbsent(enchantment.getName(), new ArrayList<>()); + byNameMap.get(enchantment.getName()).add(enchantment); + nameSortedEnchantments.add(enchantment); if(!enchantment.isGetOptimised()){ @@ -112,7 +120,7 @@ public class CAEnchantmentRegistry { public boolean unregister(@Nullable CAEnchantment enchantment){ if(enchantment == null) return false; byKeyMap.remove(enchantment.getKey()); - byNameMap.remove(enchantment.getName()); + byNameMap.get(enchantment.getName()).remove(enchantment); nameSortedEnchantments.remove(enchantment); @@ -135,10 +143,26 @@ public class CAEnchantmentRegistry { * Gets the enchantment by the provided name. * @param name Name to fetch. * @return Registered enchantment. null if absent. + * + * @deprecated use {@link #getListByName(String)} */ + @Deprecated(since = "1.6.3") @Nullable public CAEnchantment getByName(@NotNull String name){ - return byNameMap.get(name); + List enchantments = getListByName(name); + if(enchantments.isEmpty()) return null; + + return enchantments.get(0); + } + + /** + * Gets list of enchantment using the provided name. + * @param name Name to fetch. + * @return List of registered enchantment. + */ + @NotNull + public List getListByName(@NotNull String name){ + return byNameMap.getOrDefault(name, Collections.emptyList()); } /** diff --git a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java index 6c44fac..a614536 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java +++ b/src/main/java/xyz/alexcrea/cuanvil/gui/config/global/EnchantCostConfigGui.java @@ -44,24 +44,16 @@ public class EnchantCostConfigGui extends AbstractEnchantConfigGui displayLore, - int min, int max, int defaultItemVal, int defaultBookVal, - int... steps) { - return new EnchantCostSettingFactory( - title, parent, - configPath, config, - displayLore, - min, max, defaultItemVal, defaultBookVal, steps); - } - /** * A factory for an enchantment cost setting gui that hold setting's information. */ public static class EnchantCostSettingFactory extends IntSettingsGui.IntSettingFactory { int defaultBookVal; + @NotNull CAEnchantment enchantment; /** * Constructor for an enchantment cost setting gui factory. * - * @param title The title of the gui. - * @param parent Parent gui to go back when completed. - * @param configPath Configuration path of this setting. - * @param config Configuration holder of this setting. - * @param displayLore Gui display item lore. - * @param min Minimum value of this setting. - * @param max Maximum value of this setting. - * @param defaultItemVal Default item value if not found on the config. - * @param defaultBookVal Default book value if not found on the config. - * @param steps List of step the value can increment/decrement. - * List's size should be between 1 (included) and 3 (included). - * it is visually preferable to have an odd number of step. - * If step only contain 1 value, no step item should be displayed. + * @param title The title of the gui. + * @param parent Parent gui to go back when completed. + * @param configPath Configuration path of this setting. + * @param config Configuration holder of this setting. + * @param displayLore Gui display item lore. + * @param min Minimum value of this setting. + * @param max Maximum value of this setting. + * @param enchantment Enchantment to change the cost to + * @param steps List of step the value can increment/decrement. + * List's size should be between 1 (included) and 3 (included). + * it is visually preferable to have an odd number of step. + * If step only contain 1 value, no step item should be displayed. */ - protected EnchantCostSettingFactory( + public EnchantCostSettingFactory( @NotNull String title, ValueUpdatableGui parent, @NotNull String configPath, @NotNull ConfigHolder config, @Nullable List displayLore, - int min, int max, int defaultItemVal, int defaultBookVal, - int... steps) { + @NotNull CAEnchantment enchantment, + int min, int max, int... steps) { super(title, parent, configPath, config, displayLore, - min, max, defaultItemVal, steps); - this.defaultBookVal = defaultBookVal; + min, max, enchantment.defaultRarity().getItemValue(), + steps); + + this.defaultBookVal = enchantment.defaultRarity().getBookValue(); + this.enchantment = enchantment; } /** @@ -311,14 +285,14 @@ public class EnchantCostSettingsGui extends IntSettingsGui { */ @Override public int getConfiguredValue() { - return this.config.getConfig().getInt(this.configPath + ITEM_PATH, this.defaultVal); + return ConfigOptions.INSTANCE.enchantmentValue(enchantment, false); } /** * @return The configured value for the enchant setting book value. */ public int getConfiguredBookValue() { - return this.config.getConfig().getInt(this.configPath + BOOK_PATH, this.defaultBookVal); + return ConfigOptions.INSTANCE.enchantmentValue(enchantment, true); } @Override diff --git a/src/main/java/xyz/alexcrea/cuanvil/update/Update_1_21.java b/src/main/java/xyz/alexcrea/cuanvil/update/Update_1_21.java index 3211497..af21989 100644 --- a/src/main/java/xyz/alexcrea/cuanvil/update/Update_1_21.java +++ b/src/main/java/xyz/alexcrea/cuanvil/update/Update_1_21.java @@ -45,13 +45,13 @@ public class Update_1_21 { addToStringList(groupConfig, "can_unbreak.groups", "mace"); // Add new enchant conflicts - addToStringList(conflictConfig, "restriction_density.enchantments", "density"); + addToStringList(conflictConfig, "restriction_density.enchantments", "minecraft:density"); addToStringList(conflictConfig, "restriction_density.notAffectedGroups", "mace", "enchanted_book"); - addToStringList(conflictConfig, "restriction_breach.enchantments", "breach"); + addToStringList(conflictConfig, "restriction_breach.enchantments", "minecraft:breach"); addToStringList(conflictConfig, "restriction_breach.notAffectedGroups", "mace", "enchanted_book"); - addToStringList(conflictConfig, "restriction_wind_burst.enchantments", "wind_burst"); + addToStringList(conflictConfig, "restriction_wind_burst.enchantments", "minecraft:wind_burst"); addToStringList(conflictConfig, "restriction_wind_burst.notAffectedGroups", "mace", "enchanted_book"); // Add mace to conflicts @@ -59,13 +59,14 @@ public class Update_1_21 { addToStringList(conflictConfig, "restriction_smite.notAffectedGroups", "mace"); addToStringList(conflictConfig, "restriction_bane_of_arthropods.notAffectedGroups", "mace"); - addToStringList(conflictConfig, "mace_enchant_conflict.enchantments", "density", "breach", "smite", "bane_of_arthropods"); + addToStringList(conflictConfig, "mace_enchant_conflict.enchantments", + "minecraft:density", "minecraft:breach", "minecraft:smite", "minecraft:bane_of_arthropods"); conflictConfig.set("mace_enchant_conflict.maxEnchantmentBeforeConflict", 1); // Add level limit - baseConfig.set("enchant_limits.density", 5); - baseConfig.set("enchant_limits.breach", 4); - baseConfig.set("enchant_limits.wind_burst", 3); + baseConfig.set("enchant_limits.minecraft:density", 5); + baseConfig.set("enchant_limits.minecraft:breach", 4); + baseConfig.set("enchant_limits.minecraft:wind_burst", 3); // Add enchant values baseConfig.set("enchant_values.density.item", 1); diff --git a/src/main/kotlin/io/delilaheve/util/ConfigOptions.kt b/src/main/kotlin/io/delilaheve/util/ConfigOptions.kt index c6e7286..f192ff9 100644 --- a/src/main/kotlin/io/delilaheve/util/ConfigOptions.kt +++ b/src/main/kotlin/io/delilaheve/util/ConfigOptions.kt @@ -301,21 +301,28 @@ object ConfigOptions { * Get the given [enchantment]'s limit */ fun enchantLimit(enchantment: CAEnchantment): Int { - return enchantLimit(enchantment.enchantmentName) + // Test namespace + var limit = enchantLimit(enchantment.key.toString()) + if(limit != null) return limit; + + // Test legacy (name only) + limit = enchantLimit(enchantment.enchantmentName) + if(limit != null) return limit; + + // get default (and test old legacy if present) + return getDefaultLevel(enchantment.enchantmentName) } /** * Get the given [enchantmentName]'s limit */ - private fun enchantLimit(enchantmentName: String): Int { - val default = getDefaultLevel(enchantmentName) + private fun enchantLimit(enchantmentName: String): Int? { val path = "${ENCHANT_LIMIT_ROOT}.$enchantmentName" return CustomAnvil.instance .config - .getInt(path, default) + .getInt(path, ENCHANT_LIMIT_RANGE.first-1) .takeIf { it in ENCHANT_LIMIT_RANGE } - ?: default } /** @@ -324,7 +331,9 @@ object ConfigOptions { private fun getDefaultLevel(enchantmentName: String, // compatibility with 1.20.5. TODO better update system ) : Int { if(enchantmentName == "sweeping_edge"){ - return enchantLimit("sweeping") + val limit = enchantLimit("sweeping") + if(limit != null) return limit + } return defaultEnchantLimit } @@ -337,7 +346,17 @@ object ConfigOptions { enchantment: CAEnchantment, isFromBook: Boolean ): Int { - return enchantmentValue(enchantment.enchantmentName, isFromBook) + // Test namespace + var limit = enchantmentValue(enchantment.key.toString(), isFromBook) + if(limit != null) return limit; + + // Test legacy (name only) + limit = enchantmentValue(enchantment.enchantmentName, isFromBook) + if(limit != null) return limit; + + // get default (and test old legacy if present) + return getDefaultValue(enchantment, isFromBook) + } /** @@ -347,36 +366,36 @@ object ConfigOptions { private fun enchantmentValue( enchantmentName: String, isFromBook: Boolean - ): Int { - val default = getDefaultValue(enchantmentName, isFromBook) - + ): Int? { val typeKey = if (isFromBook) KEY_BOOK else KEY_ITEM val path = "${ENCHANT_VALUES_ROOT}.${enchantmentName}.$typeKey" return CustomAnvil.instance .config - .getInt(path, default) + .getInt(path, DEFAULT_ENCHANT_VALUE - 1) .takeIf { it >= DEFAULT_ENCHANT_VALUE } - ?: DEFAULT_ENCHANT_VALUE } /** * Get default value if enchantment do not exist on config */ - private fun getDefaultValue(enchantmentName: String, // compatibility with 1.20.5. TODO better update system + private fun getDefaultValue(enchantment: CAEnchantment, // compatibility with 1.20.5. TODO better update system isFromBook: Boolean) : Int { - if(enchantmentName == "sweeping_edge"){ - return enchantmentValue("sweeping", isFromBook) + + val enchantmentName = enchantment.key.toString() + if(enchantmentName == "minecraft:sweeping_edge"){ + var limit = enchantmentValue("minecraft:sweeping", isFromBook) + if(limit != null) return limit + + // legacy name + limit = enchantmentValue("sweeping", isFromBook) + if(limit != null) return limit } - val enchantment = CAEnchantment.getByName(enchantmentName) - if(enchantment != null){ - val rarity = enchantment.defaultRarity() - - return if(isFromBook) rarity.bookValue - else rarity.itemValue - } - - return DEFAULT_ENCHANT_VALUE + val rarity = enchantment.defaultRarity() + return if(isFromBook) + rarity.bookValue + else + rarity.itemValue } /** @@ -384,28 +403,39 @@ object ConfigOptions { * a negative value would mean never disabled */ fun maxBeforeMergeDisabled(enchantment: CAEnchantment): Int { - return maxBeforeMergeDisabled(enchantment.enchantmentName) + val key = enchantment.key.toString() + var value = maxBeforeMergeDisabled(key) + if(value != null) return value + + // Legacy name + val legacy = enchantment.enchantmentName + value = maxBeforeMergeDisabled(legacy) + if(value != null) return value + + if(key == "minecraft:sweeping_edge"){ + value = maxBeforeMergeDisabled("minecraft:sweeping") + if(value != null) return value + + // legacy name of legacy enchantment name + value = maxBeforeMergeDisabled("sweeping") + if(value != null) return value + } + + return DEFAULT_MAX_BEFORE_MERGE_DISABLED } /** * Get the given [enchantmentName]'s level before merge is disabled * a negative value would mean never disabled */ - private fun maxBeforeMergeDisabled(enchantmentName: String) : Int { + private fun maxBeforeMergeDisabled(enchantmentName: String) : Int? { // find if set val path = "${DISABLE_MERGE_OVER_ROOT}.$enchantmentName" - val value = CustomAnvil.instance + return CustomAnvil.instance .config - .getInt(path, DEFAULT_MAX_BEFORE_MERGE_DISABLED) + .getInt(path, ENCHANT_LIMIT_RANGE.min() - 1) .takeIf { it in ENCHANT_LIMIT_RANGE } - ?: DEFAULT_MAX_BEFORE_MERGE_DISABLED; - - if((value == DEFAULT_MAX_BEFORE_MERGE_DISABLED) && (enchantmentName == "sweeping_edge")){ - return maxBeforeMergeDisabled("sweeping") - } - - return value } } diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictGroup.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictGroup.kt index c58c6bf..56e923f 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictGroup.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictGroup.kt @@ -15,6 +15,9 @@ class EnchantConflictGroup( fun addEnchantment(enchant: CAEnchantment) { enchantments.add(enchant) } + fun addEnchantments(enchants: List) { + enchantments.addAll(enchants) + } fun allowed(enchants: Set, mat: Material): Boolean { if (enchantments.size < minBeforeBlock) { diff --git a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt index abebcbc..0c0850b 100644 --- a/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt +++ b/src/main/kotlin/xyz/alexcrea/cuanvil/group/EnchantConflictManager.kt @@ -30,9 +30,9 @@ class EnchantConflictManager { const val DEFAULT_GROUP_NAME = "joinedGroup" // 1.20.5 compatibility TODO better update system - private val SWEEPING_EDGE_ENCHANT = + private val SWEEPING_EDGE_ENCHANT = Collections.singletonList( CAEnchantment.getByKey(NamespacedKey.minecraft("sweeping_edge")) ?: - CAEnchantment.getByKey(Enchantment.SWEEPING_EDGE.key) + CAEnchantment.getByKey(Enchantment.SWEEPING_EDGE.key)) } @@ -94,14 +94,14 @@ class EnchantConflictManager { // Read and add enchantment to conflict val enchantList = section.getStringList(ENCH_LIST_PATH) for (enchantName in enchantList) { - val enchant = getEnchantByName(enchantName) - if (enchant == null) { + val enchants = getEnchantByIdentifier(enchantName) + if (enchants.isEmpty()) { if (!futureUse) { //TODO future use will be deprecated once the new update system is finished CustomAnvil.instance.logger.warning("Enchantment $enchantName do not exist but was asked for conflict $conflictName") } continue } - conflict.addEnchantment(enchant) + conflict.addEnchantments(enchants) } if (conflict.getEnchants().isEmpty()) { if (!futureUse) { //TODO future use will be deprecated once the new update system is finished @@ -112,16 +112,23 @@ class EnchantConflictManager { return conflict } - private fun getEnchantByName(enchantName: String): CAEnchantment? { + private fun getEnchantByIdentifier(enchantName: String): List { + val key = NamespacedKey.fromString(enchantName) + if(key != null){ + val enchantment = CAEnchantment.getByKey(key) + if(enchantment != null) return Collections.singletonList(enchantment) + + } // Temporary solution for 1.20.5 when(enchantName){ - "sweeping", "sweeping_edge" -> { + "minecraft:sweeping", "sweeping", + "minecraft:sweeping_edge", "sweeping_edge" -> { return SWEEPING_EDGE_ENCHANT } } - return CAEnchantment.getByName(enchantName) + return CAEnchantment.getListByName(enchantName) } diff --git a/src/main/resources/config.yml b/src/main/resources/config.yml index 82b28a8..dd24558 100644 --- a/src/main/resources/config.yml +++ b/src/main/resources/config.yml @@ -97,46 +97,46 @@ default_limit: 5 # # Valid range of 1 - 255 for each enchantment enchant_limits: - aqua_affinity: 1 - binding_curse: 1 - channeling: 1 - flame: 1 - infinity: 1 - mending: 1 - multishot: 1 - silk_touch: 1 - vanishing_curse: 1 - depth_strider: 3 # anything more than 3 is treated as 3 by the game - protection: 4 - fire_protection: 4 - blast_protection: 4 - projectile_protection: 4 - feather_falling: 4 - thorns: 3 - respiration: 3 - sharpness: 5 - smite: 5 - bane_of_arthropods: 5 - knockback: 2 - fire_aspect: 2 - looting: 3 - sweeping: 3 - sweeping_edge: 3 - efficiency: 5 - unbreaking: 3 - fortune: 3 - power: 5 - punch: 2 - luck_of_the_sea: 3 - lure: 3 - frost_walker: 2 - impaling: 5 - riptide: 3 - loyalty: 3 - piercing: 4 - quick_charge: 3 - soul_speed: 3 - swift_sneak: 3 + minecraft:aqua_affinity: 1 + minecraft:binding_curse: 1 + minecraft:channeling: 1 + minecraft:flame: 1 + minecraft:infinity: 1 + minecraft:mending: 1 + minecraft:multishot: 1 + minecraft:silk_touch: 1 + minecraft:vanishing_curse: 1 + minecraft:depth_strider: 3 # anything more than 3 is treated as 3 by the game + minecraft:protection: 4 + minecraft:fire_protection: 4 + minecraft:blast_protection: 4 + minecraft:projectile_protection: 4 + minecraft:feather_falling: 4 + minecraft:thorns: 3 + minecraft:respiration: 3 + minecraft:sharpness: 5 + minecraft:smite: 5 + minecraft:bane_of_arthropods: 5 + minecraft:knockback: 2 + minecraft:fire_aspect: 2 + minecraft:looting: 3 + minecraft:sweeping: 3 + minecraft:sweeping_edge: 3 + minecraft:efficiency: 5 + minecraft:unbreaking: 3 + minecraft:fortune: 3 + minecraft:power: 5 + minecraft:punch: 2 + minecraft:luck_of_the_sea: 3 + minecraft:lure: 3 + minecraft:frost_walker: 2 + minecraft:impaling: 5 + minecraft:riptide: 3 + minecraft:loyalty: 3 + minecraft:piercing: 4 + minecraft:quick_charge: 3 + minecraft:soul_speed: 3 + minecraft:swift_sneak: 3 # Multipliers used to calculate the enchantment's value in repair/combining # @@ -150,124 +150,124 @@ enchant_limits: # With default values protection 4 would have a value of 4 when # coming from either a book (4 * 1) or an item (4 * 1) enchant_values: - aqua_affinity: + minecraft:aqua_affinity: item: 4 book: 2 - bane_of_arthropods: + minecraft:bane_of_arthropods: item: 2 book: 1 - binding_curse: + minecraft:binding_curse: item: 8 book: 4 - blast_protection: + minecraft:blast_protection: item: 4 book: 2 - channeling: + minecraft:channeling: item: 8 book: 4 - depth_strider: + minecraft:depth_strider: item: 4 book: 2 - efficiency: + minecraft:efficiency: item: 1 book: 1 - flame: + minecraft:flame: item: 4 book: 2 - feather_falling: + minecraft:feather_falling: item: 2 book: 1 - fire_aspect: + minecraft:fire_aspect: item: 4 book: 2 - fire_protection: + minecraft:fire_protection: item: 2 book: 1 - fortune: + minecraft:fortune: item: 4 book: 2 - frost_walker: + minecraft:frost_walker: item: 4 book: 2 - impaling: + minecraft:impaling: item: 4 book: 2 - infinity: + minecraft:infinity: item: 8 book: 4 - knockback: + minecraft:knockback: item: 2 book: 1 - looting: + minecraft:looting: item: 4 book: 2 - loyalty: + minecraft:loyalty: item: 1 book: 1 - luck_of_the_sea: + minecraft:luck_of_the_sea: item: 4 book: 2 - lure: + minecraft:lure: item: 4 book: 2 - mending: + minecraft:mending: item: 4 book: 2 - multishot: + minecraft:multishot: item: 4 book: 2 - piercing: + minecraft:piercing: item: 1 book: 1 - power: + minecraft:power: item: 1 book: 1 - projectile_protection: + minecraft:projectile_protection: item: 2 book: 1 - protection: + minecraft:protection: item: 1 book: 1 - punch: + minecraft:punch: item: 4 book: 2 - quick_charge: + minecraft:quick_charge: item: 2 book: 1 - respiration: + minecraft:respiration: item: 4 book: 2 - riptide: + minecraft:riptide: item: 4 book: 2 - silk_touch: + minecraft:silk_touch: item: 8 book: 4 - sharpness: + minecraft:sharpness: item: 1 book: 1 - smite: + minecraft:smite: item: 2 book: 1 - soul_speed: + minecraft:soul_speed: item: 8 book: 4 - swift_sneak: + minecraft:swift_sneak: item: 8 book: 4 - sweeping: + minecraft:sweeping: item: 4 book: 2 - sweeping_edge: + minecraft:sweeping_edge: item: 4 book: 2 - thorns: + minecraft:thorns: item: 8 book: 4 - unbreaking: + minecraft:unbreaking: item: 2 book: 1 - vanishing_curse: + minecraft:vanishing_curse: item: 8 book: 4 @@ -278,9 +278,9 @@ enchant_values: # -1 mean enchantment merge for this enchantment is not disabled. default to -1 if absent. disable-merge-over: # Sharpness is set to -1. it equivalent to it not being set to anything (and work as vanilla) - sharpness: -1 + minecraft:sharpness: -1 # If uncommented. 2 unbreaking II book would not give an unbreaking III book. but unbreaking III book can still be applied - #unbreaking: 2 + #minecraft:unbreaking: 2 # Whether to show debug logging debug_log: false diff --git a/src/main/resources/enchant_conflict.yml b/src/main/resources/enchant_conflict.yml index ed154ab..0e8b3f3 100644 --- a/src/main/resources/enchant_conflict.yml +++ b/src/main/resources/enchant_conflict.yml @@ -17,158 +17,158 @@ # ---------------------------------------------------- restriction_aqua_affinity: - enchantments: [ aqua_affinity ] + enchantments: [ minecraft:aqua_affinity ] notAffectedGroups: [ enchanted_book, helmets ] restriction_bane_of_arthropods: - enchantments: [ bane_of_arthropods ] + enchantments: [ minecraft:bane_of_arthropods ] notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_blast_protection: - enchantments: [ blast_protection ] + enchantments: [ minecraft:blast_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_channeling: - enchantments: [ channeling ] + enchantments: [ minecraft:channeling ] notAffectedGroups: [ enchanted_book, trident ] restriction_binding_curse: - enchantments: [ binding_curse ] + enchantments: [ minecraft:binding_curse ] notAffectedGroups: [ enchanted_book, wearable ] restriction_vanishing_curse: - enchantments: [ vanishing_curse ] + enchantments: [ minecraft:vanishing_curse ] notAffectedGroups: [ enchanted_book, can_vanish ] restriction_depth_strider: - enchantments: [ depth_strider ] + enchantments: [ minecraft:depth_strider ] notAffectedGroups: [ enchanted_book, boots ] restriction_efficiency: - enchantments: [ efficiency ] + enchantments: [ minecraft:efficiency ] notAffectedGroups: [ enchanted_book, tools, shears ] restriction_feather_falling: - enchantments: [ feather_falling ] + enchantments: [ minecraft:feather_falling ] notAffectedGroups: [ enchanted_book, boots ] restriction_fire_aspect: - enchantments: [ fire_aspect ] + enchantments: [ minecraft:fire_aspect ] notAffectedGroups: [ enchanted_book, swords ] restriction_fire_protection: - enchantments: [ fire_protection ] + enchantments: [ minecraft:fire_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_flame: - enchantments: [ flame ] + enchantments: [ minecraft:flame ] notAffectedGroups: [ enchanted_book, bow ] restriction_fortune: - enchantments: [ fortune ] + enchantments: [ minecraft:fortune ] notAffectedGroups: [ enchanted_book, tools ] restriction_frost_walker: - enchantments: [ frost_walker ] + enchantments: [ minecraft:frost_walker ] notAffectedGroups: [ enchanted_book, boots ] restriction_impaling: - enchantments: [ impaling ] + enchantments: [ minecraft:impaling ] notAffectedGroups: [ enchanted_book, trident ] restriction_infinity: - enchantments: [ infinity ] + enchantments: [ minecraft:infinity ] notAffectedGroups: [ enchanted_book, bow ] restriction_knockback: - enchantments: [ knockback ] + enchantments: [ minecraft:knockback ] notAffectedGroups: [ enchanted_book, swords ] restriction_looting: - enchantments: [ looting ] + enchantments: [ minecraft:looting ] notAffectedGroups: [ enchanted_book, swords ] restriction_loyalty: - enchantments: [ loyalty ] + enchantments: [ minecraft:loyalty ] notAffectedGroups: [ enchanted_book, trident ] restriction_lure: - enchantments: [ lure ] + enchantments: [ minecraft:lure ] notAffectedGroups: [ enchanted_book, fishing_rod ] restriction_mending: - enchantments: [ mending ] + enchantments: [ minecraft:mending ] notAffectedGroups: [ enchanted_book, can_unbreak ] -restriction_multishot: - enchantments: [ multishot ] +restriction_minecraft_multishot: + enchantments: [ minecraft:multishot ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_piercing: - enchantments: [ piercing ] + enchantments: [ minecraft:piercing ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_power: - enchantments: [ power ] + enchantments: [ minecraft:power ] notAffectedGroups: [ enchanted_book, bow ] restriction_projectile_protection: - enchantments: [ projectile_protection ] + enchantments: [ minecraft:projectile_protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_protection: - enchantments: [ protection ] + enchantments: [ minecraft:protection ] notAffectedGroups: [ enchanted_book, armors ] restriction_punch: - enchantments: [ punch ] + enchantments: [ minecraft:punch ] notAffectedGroups: [ enchanted_book, bow ] restriction_quick_charge: - enchantments: [ quick_charge ] + enchantments: [ minecraft:quick_charge ] notAffectedGroups: [ enchanted_book, crossbow ] restriction_respiration: - enchantments: [ respiration ] + enchantments: [ minecraft:respiration ] notAffectedGroups: [ enchanted_book, helmets ] restriction_riptide: - enchantments: [ riptide ] + enchantments: [ minecraft:riptide ] notAffectedGroups: [ enchanted_book, trident ] restriction_sharpness: - enchantments: [ sharpness ] + enchantments: [ minecraft:sharpness ] notAffectedGroups: [ enchanted_book, melee_weapons ] -restriction_silk_touch: - enchantments: [ silk_touch ] +restriction__silk_touch: + enchantments: [ minecraft:silk_touch ] notAffectedGroups: [ enchanted_book, tools ] restriction_smite: - enchantments: [ smite ] + enchantments: [ minecraft:smite ] notAffectedGroups: [ enchanted_book, melee_weapons ] restriction_soul_speed: - enchantments: [ soul_speed ] + enchantments: [ minecraft:soul_speed ] notAffectedGroups: [ enchanted_book, boots ] restriction_sweeping_edge: - enchantments: [ sweeping, sweeping_edge ] + enchantments: [ minecraft:sweeping, minecraft:sweeping_edge ] notAffectedGroups: [ enchanted_book, swords ] # Do not exist in 1.18, that mean useInFuture will be set to true # useInFuture set to true also mean it will not warn if there is an issue restriction_swift_sneak: useInFuture: true - enchantments: [ swift_sneak ] + enchantments: [ minecraft:swift_sneak ] notAffectedGroups: [ enchanted_book, leggings ] restriction_thorns: - enchantments: [ thorns ] + enchantments: [ minecraft:thorns ] notAffectedGroups: [ enchanted_book, armors ] -restriction_unbreaking: - enchantments: [ unbreaking ] +restriction__unbreaking: + enchantments: [ minecraft:unbreaking ] notAffectedGroups: [ enchanted_book, can_unbreak ] # ---------------------------------------------------- @@ -180,60 +180,60 @@ restriction_unbreaking: sword_enchant_conflict: enchantments: - - bane_of_arthropods - - smite - - sharpness + - minecraft:bane_of_arthropods + - minecraft:smite + - minecraft:sharpness notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 protection_enchant_conflict: enchantments: - - blast_protection - - fire_protection - - projectile_protection - - protection + - minecraft:blast_protection + - minecraft:fire_protection + - minecraft:projectile_protection + - minecraft:protection notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict1: enchantments: - - channeling - - riptide + - minecraft:channeling + - minecraft:riptide notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 trident_conflict2: enchantments: - - loyalty - - riptide + - minecraft:loyalty + - minecraft:riptide notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 boot_conflict: enchantments: - - depth_strider - - frost_walker + - minecraft:depth_strider + - minecraft:frost_walker notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 tool_conflict: enchantments: - - fortune - - silk_touch + - minecraft:fortune + - minecraft:silk_touch notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 bow_conflict: enchantments: - - mending - - infinity + - minecraft:mending + - minecraft:infinity notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1 crossbow_conflict: enchantments: - - multishot - - piercing + - minecraft:multishot + - minecraft:piercing notAffectedGroups: [ ] maxEnchantmentBeforeConflict: 1