Skip to content

Add component-friendly alternatives to FabricItem methods (e.g. events) #5242

@reoseah

Description

@reoseah

Nowadays you usually don't need to to make your own class for items, many things can be done with components. However, FabricItem requires you to have a subclass as the way you use it is by overriding the methods it adds.

Additionally, if Mojang continues to make items "data-driven" and, e.g., makes Item class a record, FabricItem would have to be removed and its features implemented in other ways.

I imagine allowComponentsUpdateAnimation and allowContinuingBlockBreaking can be replaced with something like ClientItemEvents#SWAP_ANIMATION and ClientItemEvents#RESET_BREAKING_PROGRESS.

EnchantmentEvents#ALLOW_ENCHANTING already exists doing similar thing to FabricItem#canBeEnchantedWith, but the latter is still directly called from some mixins.

getCraftingRemainder and getCreatorNamespace can also be replaced with new events or with some sort of registry.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions