Zacomat Posted March 1, 2017 Posted March 1, 2017 On the RegistryEvent.Register<Item> event I made a substitution alias: GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, myEmptyMap); where myEmptyMap is an instance of com.example.MyEmptyMap that extends net.minecraft.item.ItemEmptyMap. In The constructor of net.minecraft.item.ItemEmptyMap there is the call to setCreativeTab(CreativeTabs.MISC); so I left my constructor empty. Why in the misc tab there are 2 minecraft:map items? How can i remove one? Thx Quote
Choonster Posted March 2, 2017 Posted March 2, 2017 (edited) I reported this here, cpw isn't intending to fix it. You can probably set the vanilla Item's creative tab to null before you substitute it to prevent it from showing up in the creative menu. Edited March 2, 2017 by Choonster Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Zacomat Posted March 2, 2017 Author Posted March 2, 2017 4 hours ago, Choonster said: I reported this here, cpw isn't intending to fix it. You can probably set the vanilla Item's creative tab to null before you substitute it to prevent it from showing up in the creative menu. As cpw said this is a sided effect so the method addSubstitutionAlias must be called only in server side. The solution is to remove it from client proxy. Thx Quote
Zacomat Posted March 2, 2017 Author Posted March 2, 2017 But if you have to overwrite a method of the item in both sides? Let's say that you want to overwrite onItemRightClick? Quote
Choonster Posted March 2, 2017 Posted March 2, 2017 11 minutes ago, Zacomat said: As cpw said this is a sided effect so the method addSubstitutionAlias must be called only in server side. The solution is to remove it from client proxy. Thx He said it's a side effect, not a sided effect. This has nothing to do with the client/server sides. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Zacomat Posted March 2, 2017 Author Posted March 2, 2017 I tried this but it does not work: @SubscribeEvent public void onRegisterEvent(RegistryEvent.Register<Item> event) { Items.MAP.setCreativeTab(null); try { GameRegistry.addSubstitutionAlias("minecraft:map", GameRegistry.Type.ITEM, MyMod.myEmptyMap); } catch (ExistingSubstitutionException e) { e.printStackTrace(); } } Still 2 items in the misc tab. Quote
Choonster Posted March 2, 2017 Posted March 2, 2017 Looking into this further, the original Item is never returned by the registry iterator used in CreativeTabs#displayAllRelevantItems; the substitution is returned twice. This explains why setting the creative tab of the original Item doesn't work. I'm not sure if there's any way to fix this. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.
Recommended Posts
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.