Posted April 12, 20178 yr Hello guy, I started programming mod very recently and i'm facing a problem with the port of my mod on server. Many peoples told that the mod is nowaday universal and works both on client and on server. However, the server refuse tu start because of java.lang.NoSuchMethodError on my registerRender() method. I specify i put the " @SideOnly(Side.CLIENT)" before but nothing change. I hope you can help me and thank you error_eclipse.txt
April 12, 20178 yr There is a section for modder support, it would probably be better if you posted there: http://www.minecraftforge.net/forum/forum/70-modder-support/ As for your problem, it's difficult to help you without being able to see your actual code. But from what I'm getting you need to use proxies: https://mcforge.readthedocs.io/en/latest/concepts/sides/ A common use case is to register renderers and models, something which must be called from the main initialization methods preInit, init, or postInit. However, many rendering related classes and registries are not present on the physical server and may crash it. Therefore, we put these actions into the client proxy, ensuring that they will always execute for the physical client. Here is what I do: My @Mod class: https://github.com/Kriptikz/Archmage/blob/1.11.2/src/main/java/kriptikz/archmage/Archmage.java My ClientProxy where I register renders for Entities: https://github.com/Kriptikz/Archmage/blob/1.11.2/src/main/java/kriptikz/archmage/proxy/ClientProxy.java#L29
April 12, 20178 yr Author Thank you for your answar, i uploaded my project here: https://github.com/TheCaliban/CaliArmor I've already used the system of proxy and preInit, init and postInit method. Maybe you can check my code and tell what is wrong. Thank you
April 13, 20178 yr The problem is when you call new ModItems(); in your common proxy preInit. Which ofc calls the constructor you made in ModItems() which calls initItems(); registerItems(); and registerRenders(); which means your calling registerRenders() in your common proxy preInit. You can only register renders on the client, so this method should only be called in your client proxy. I explain the steps to fix up your code below: First get rid of this constructor: https://github.com/TheCaliban/CaliArmor/blob/master/src/main/java/com/mod/CaliArmor/init/ModItems.java#L29-L34 And make all your methods in ModItems static. Then instead of creating an instance here: https://github.com/TheCaliban/CaliArmor/blob/master/src/main/java/com/mod/CaliArmor/proxy/CommonProxy.java#L9 do this: public class CommonProxy { public void preInit() { // Get rid of this, as methods should be all static now //new ModItems(); // initialize items ModItems.initItems(); // register items ModItems.registerItems(); } public void Init() { new ModRecipes().registerCraftRecipes(); new ModRecipes().registerFurnaceRecipes(); new ModRecipes().registerBrewingRecipes(); } } Then for your ClientProxy: public class ClientProxy extends CommonProxy { @Override public void preInit() { super.preInit(); // register renders ModItems.registerRenders(); } @Override public void Init() { super.Init(); } } Edited April 13, 20178 yr by Kriptikz
April 13, 20178 yr No problem, for future reference you should post in Modder Support: http://www.minecraftforge.net/forum/forum/70-modder-support/
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.