Jump to content

Item Substitution Aliases break recipes and trades


Recommended Posts

In my mod i have some item Substitution Aliases that I register with 



public void onRegisterItem(RegistryEvent.Register<Item> event) {

    try {

        GameRegistry.addSubstitutionAlias("minecraft:compass", GameRegistry.Type.ITEM, GiacomosTeleport.myCompass);

        GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, GiacomosTeleport.myEmptyMap);

        GameRegistry.addSubstitutionAlias("minecraft:filled_map", GameRegistry.Type.ITEM, GiacomosTeleport.myFilledyMap);

    } catch (ExistingSubstitutionException e) {





But recipes and trades that use aliased items seem broken.

I try to fix this in the init method:



public void init(FMLInitializationEvent event) {


//Overwriting some recipes to fix bugs: recipes that use maps or compasses are broken!!!

RecipeSorter.register(MODID + ":mapextending", RecipesMyMapExtending.class, SHAPED, "after:minecraft:shaped before:minecraft:shapeless");

RecipeSorter.register(MODID + ":mapcloning", RecipesMyMapCloning.class, SHAPELESS, "after:minecraft:shaped before:minecraft:shapeless");

GameRegistry.addRecipe(new RecipesMyMapExtending());

GameRegistry.addRecipe(new RecipesMyMapCloning());


GameRegistry.addShapedRecipe(new ItemStack(myEmptyMap), "ppp", "pbp", "ppp", 'b', Items.COMPASS, 'p', Items.PAPER);

GameRegistry.addShapedRecipe(new ItemStack(myCompass), " i ", "iri", " i ", 'r', Items.REDSTONE, 'i', Items.IRON_INGOT);


//Overwriting items in trades: Fix cartographer trade compass for emeralds!!! 

VillagerProfession profession = VillagerRegistry.getById(1);

VillagerCareer career = profession.getCareer(1);

EmeraldForItems trade = (EmeraldForItems) career.getTrades(1).get(0);


trade.buyingItem = Items.COMPASS;




This way it seems to work but is this the right way? 

Link to comment
Share on other sites

So the suggestion is to avoid using substitution aliases... 

And I also think so, but in ItemMyCompass I have other stuff for handling enchantments: only enchanted compasses and maps can be used to teleport.

And the player should perform and animation during the cast.

The question is how to make substitution aliases work with trades and recipes?


Link to comment
Share on other sites

Yes, you are right! I implemented the teleport with events you suggested and it works fine!

There are still two things I do not know how to do:

1) How to set an animation during item usage (using compasses with the bow animation was funny)

2) When an empty map is rightclicked  i want to add to the resulting filled map a tag that contains the coordinates where the map was created to use for teleport back there



Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...

Important Information

By using this site, you agree to our Terms of Use.