sunsigne Posted July 24, 2019 Share Posted July 24, 2019 Hello, Does anyone find how to implement a brewing reciepe in 1.13.2 yet ? It doesn't seem to be in datapack, the fonction "addmix" in PotionBrewing class is now private, and IForgeRegistry doesn't work for this class (as it's neither Potion class, neither PotionType class) Thank Quote Link to comment Share on other sites More sharing options...
The_Wabbit Posted July 25, 2019 Share Posted July 25, 2019 This was registered as an issue. Probably pretty low on the devs priority list for 1.14 just yet though. https://github.com/MinecraftForge/MinecraftForge/issues/5814 1 Quote Link to comment Share on other sites More sharing options...
sunsigne Posted July 25, 2019 Author Share Posted July 25, 2019 ok ty i'll probably try to see if i can rewitre entirely the brewing_stand by now ^^ it's a lot of work for a tiny potion, but as long as it works as final ... Quote Link to comment Share on other sites More sharing options...
DavidM Posted July 26, 2019 Share Posted July 26, 2019 (edited) On 7/25/2019 at 3:17 PM, sunsigne said: ok ty i'll probably try to see if i can rewitre entirely the brewing_stand by now ^^ it's a lot of work for a tiny potion, but as long as it works as final ... Even if there is no way of adding a brewing recipe, there is reflection. It would be better than copying & pasting an entire vanilla class and screwing all mods with custom brewing stands... Edited July 26, 2019 by DavidM Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support. Link to comment Share on other sites More sharing options...
sunsigne Posted July 30, 2019 Author Share Posted July 30, 2019 Perfect ! I finally found out how to register potion recipes ! (thank to reflection) for curious people, here is the solution : Spoiler In MAIN class : public YourMainClass () { FMLJavaModLoadingContext.get().getModEventBus().addListener(this::RegisterPlus); } private void RegisterPlus(final FMLCommonSetupEvent event) { try { RegisterPlus.addMix(PotionTypes.AWKWARD, Items.REDSTONE, ModPotionType.your_potion); } catch (Exception e) { e.printStackTrace();} } In a classe you called RegisterPlus : public class RegisterPlus { public static void addMix(PotionType p_193357_0_, Item p_193357_1_, PotionType p_193357_2_) throws Exception { Method method = PotionBrewing.class.getDeclaredMethod("addMix", PotionType.class, Item.class, PotionType.class); method.setAccessible(true); method.invoke(null, p_193357_0_, p_193357_1_, p_193357_2_); } } Hope it will help someone ^^ Quote Link to comment Share on other sites More sharing options...
The_Wabbit Posted July 30, 2019 Share Posted July 30, 2019 If you only need to use addMix there is also a non-reflection alternative that uses a brewing recipe via BrewingRecipeRegistry.addRecipe(...). Note there is a bug (1.14.3) in the Forge default BrewingRecipe so you should roll your own fixing the following in the isInput method like: public class ModBrewingRecipe extends BrewingRecipe { public ModBrewingRecipe(ItemStack input, Ingredient ingredient, ItemStack output) { super(input,ingredient,output); } @Override public boolean isInput(ItemStack stack) { return ItemStack.areItemsEqual(super.getInput(),stack); //THIS IS BROKEN in super 1.14.3 } } Pass in filled in potion itemstacks (see PotionUtils.addPotionToItemStack) for the input and outputs (eg Awkward potion -> Your potion) Quote Link to comment Share on other sites More sharing options...
DavidM Posted July 31, 2019 Share Posted July 31, 2019 9 hours ago, sunsigne said: public static void addMix(PotionType p_193357_0_, Item p_193357_1_, PotionType p_193357_2_) throws Exception { Method method = PotionBrewing.class.getDeclaredMethod("addMix", PotionType.class, Item.class, PotionType.class); method.setAccessible(true); method.invoke(null, p_193357_0_, p_193357_1_, p_193357_2_); } Reflection is expensive. Use it once and store the method in a static field. Quote Some tips: Spoiler Modder Support: Spoiler 1. Do not follow tutorials on YouTube, especially TechnoVision (previously called Loremaster) and HarryTalks, due to their promotion of bad practice and usage of outdated code. 2. Always post your code. 3. Never copy and paste code. You won't learn anything from doing that. 4. Quote Programming via Eclipse's hotfixes will get you nowhere 5. Learn to use your IDE, especially the debugger. 6. Quote The "picture that's worth 1000 words" only works if there's an obvious problem or a freehand red circle around it. Support & Bug Reports: Spoiler 1. Read the EAQ before asking for help. Remember to provide the appropriate log(s). 2. Versions below 1.11 are no longer supported due to their age. Update to a modern version of Minecraft to receive support. Link to comment Share on other sites More sharing options...
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.