Skip to content

EnchantmentBook Registration always with same NamespaceID -> Override #9

Open
@Verox001

Description

@Verox001

By using the Enchantment#register method and setting the second argument (registerItem) to true, doesn't register ALL enchantment books correctly. Even though having an enchantment with MaxLevel 5, it only registers the book for level one.

Why does this happen?

The reason may be that all custom registered books use the same NamespaceId of the Enchantment, which results in all other enchantment books after level one not being registered, since there already is one with the same NamespaceId registered.
https://github.com/PowerNukkitX/PowerNukkitX/blob/1dfc7db755ecd638366d65caf4c1c179817841da/src/main/java/cn/nukkit/item/enchantment/Enchantment.java#L367

I created my own EnchantmentBook classes with unique NamespaceIds and it worked like a charm.

📋 Debug information

  • PowerNukkit version: 1.20.10-r1

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions