#Prevent enchanted items from increasing in rarity
2 messages · Page 1 of 1 (latest)
[➤](#1247762040479678554 message)
I made a loop that allows you to quickly add rarities in an organized way !
Basically, each line in rarity_items is an array, an array of a single value allows you to change the targeted mod by entering its namespace, arrays that have multiple values allow you to apply rarities by entering the enum of the rarity (also works with non-vanilla rarities if created before) followed by the name of all the items which must have this rarity in the targeted mod, I find that it allows you to have something easily re-readable and it avoids the redundancy that the we have by typing modname:item for each element ^^
Code with some config as an example :
startup_scripts
ItemEvents.modification(event => {
const rarity_items = [
['lightmanscurrency'],
['LEGENDARY','wallet_netherite','coin_netherite','coinpile_netherite','coinblock_netherite'],
['EPIC','wallet_diamond','coin_diamond','coinpile_diamond','coinblock_diamond'],
['RARE','wallet_emerald','coin_emerald','coinpile_emerald','coinblock_emerald'],
['UNCOMMON','wallet_gold','coin_gold','coinpile_gold','coinblock_gold'],
['sophisticatedbackpacks'],
['LEGENDARY','netherite_backpack'],
['EPIC','diamond_backpack'],
['RARE','gold_backpack'],
['UNCOMMON','iron_backpack'],
['apotheotic_additions'],
['MYTHIC','mythicapple'],
['EPIC','epicapple'],
['RARE','rareapple'],
['trofers'],
['LEGENDARY','small_pillar','medium_pillar','large_pillar','small_plate','medium_plate','large_plate'],
['minecraft'],
['ARTIFACT','diamond_helmet'],
['LEGENDARY','netherite_ingot'],
['EPIC','ancient_debris','netherite_scrap','diamond'],
['RARE','emerald'],
['UNCOMMON','ender_pearl','gold_ingot','raw_gold']
]
let mod = "";
for (const items_group of rarity_items) {
if(items_group.length == 1) { mod = items_group[0]; }
for (const item of items_group) {
if(item == items_group[0]) { continue; }
event.modify(mod+':'+item, i => { i.rarity = items_group[0] })
}
}
})```