Skip to content

Instantly share code, notes, and snippets.

@eggohito
Last active May 17, 2024 04:06
Show Gist options
  • Save eggohito/3c567caaed0d1a73a9fe7f35911dc821 to your computer and use it in GitHub Desktop.
Save eggohito/3c567caaed0d1a73a9fe7f35911dc821 to your computer and use it in GitHub Desktop.
A guide to migrate from Apoli's identifier aliasing system to Calio's identifier aliasing system.

TL;DR for addon developers

If your addon provides aliases for identifiers with IdentifierAlias, you will have to change several things on your side:

  • Change the import for the class from io.github.apace100.apoli.util.IdentifierAlias to io.github.apace100.calio.util.IdentifierAlias.
  • If you're still using NamespaceAlias, it has been removed. Use IdentifierAlias#addNamespaceAlias from an IdentifierAlias instance instead.
  • Aliases are no longer global by default, and have now been split to two: "local" and "global". To add aliases, you will have to add them in a static field defined in certain classes:
    • IdentifierAlias#GLOBAL for global aliases.
    • PowerFactories#ALIASES for power types.
    • BiEntityActions#ALIASES for bi-entity action types.
    • BlockActions#ALIASES for block action types.
    • EntityActions#ALIASES for entity action types.
    • ItemActions#ALIASES for item action types.
    • BiEntityConditions#ALIASES for bi-entity condition types.
    • BiomeConditions#ALIASES for biome condition types.
    • BlockConditions#ALIASES for block condition types.
    • DamageConditions#ALIASES for damage condition types.
    • EntityConditions#ALIASES for entity condition types.
    • FluidConditions#ALIASES for fluid condition types.
    • ItemConditions#ALIASES for item condition types.

Why the breaking change?

The implementation of identifier aliasing has been changed in order to accommodate for the use-case of resolving aliases within a scope, such as resolving aliases of identifiers for objects of certain registries.

With the previous implementation, it's not possible to provide different aliases for different registries since the aliases are stored globally, which can cause conflicts (e.g: it cannot distinguish between an alias added to the minecraft:dirt item ID and minecraft:dirt block ID.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment