Posted April 27, 20178 yr In my mod i have some item Substitution Aliases that I register with @SubscribeEvent 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) { e.printStackTrace(); } } But recipes and trades that use aliased items seem broken. I try to fix this in the init method: @EventHandler 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?
April 27, 20178 yr Author This is a teleport mod. The player can teleport by using a compass or a map. In the method Item.onItemUseFinish is where the teleport is implemented.
April 28, 20178 yr Author 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?
April 28, 20178 yr Author 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
April 28, 20178 yr Author I have a new question How do i make my items work in the enchanting table without overriding Item.isEnchantable(ItemStack)?
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.