Knokko's Custom Items

Knokko's Custom Items

37.4k Downloads

Keep enchantments from EcoEnchants after upgrading an item

knokko opened this issue ยท 1 comments

commented

Currently, when performing an upgrade recipe with Keep old enchantments and a non-null New type, custom enchantments from the EcoEnchants plug-in are not preserved, which is undesirable.

commented

Hm... this is going to be more difficult than I anticipated...

ASCEND level is 0 on item stack ItemStack{DIAMOND_SWORD x 1, UNSPECIFIC_META:{meta-type=UNSPECIFIC, lore=[], enchants={ASCEND=1, CHARGE=2, DAMAGE_ALL=5}, attribute-modifiers={GENERIC_MAX_HEALTH=[AttributeModifier{uuid=00000009-4715-fbea-ffff-fd8160d90e88, name=dummy, operation=ADD_NUMBER, amount=0.0, slot=}]}, ItemFlags=[HIDE_ATTRIBUTES, HIDE_UNBREAKABLE], Unbreakable=true, Damage=1, internal=H4sIAAAAAAAA/+NiYOBiEPXOy8/Ozi92Li0uyc8NLUgvSkxJLeZg4HHNS85IzCvJTc0rKWbgSkqEAaCUY0lJUWZSaUmqp0sxA8gQIRRDPEtSc4tZGPh8EotLXCsK8otKQjJzUxkYGDutbnZxsDOIOuXn56Qm5gWlFhSlFgPNTyzJzM8DGpRqycILpE5vO5/m/0ioyap42u4//379+/dv8lKG/SDw+/Tv3yz/36MAASAWe3Swe/15EA9MvJdP7//+/fvnny++/g3Y/OfPv3+M/0/+/fn379+vQMzBwOKXCHQPU1IGAwMAR/5wdgQBAAA=}}
for (Enchantment enchantment : Enchantment.values()) {
    int totalLevel = currentStack.getEnchantmentLevel(enchantment);
    if (enchantment.getName().equals("ASCEND")) {
        System.out.println("ASCEND level is " + totalLevel + " on item stack " + currentStack);
    }