Posted July 24, 20178 yr I have a question, I notice this happens for entities but not for items/blocks I have a class for example named "ModItems" and in there I have 2 methods, one for registering the items (called from the mod main class) and other for registering the renders (called from the client proxy) So far so good. Problem is, when I do the same for TileEntities, when I try to launch server it complains that I'm calling the register of renders for entities from the server side. Even when that's not actually happening. java.lang.NoClassDefFoundError: net/minecraft/client/renderer/tileentity/TileEntitySpecialRenderer at com.mramericanmike.irishluck.IrishLuck.preInit(IrishLuck.java:88) ~[bin/:?] That line actually is ModTE.init(); And ModTE is public class ModTE { public static void init() { GameRegistry.registerTileEntity(TEBlockError404.class, "block_irishluck_big_404"); GameRegistry.registerTileEntity(TEBlockGhost.class, "block_ghost"); } public static void registerRenders() { TileEntitySpecialRenderer renderBE404 = new RenderBlockError404(); ClientRegistry.bindTileEntitySpecialRenderer(TEBlockError404.class, renderBE404); } } And... Probably here is my problem, as I write it I notice this, I'm calling that regsterRenders from ClientProxy preInit public void preInit() { //Register Renders on Client Side Only ModItems.registerRenders(); ModBlocks.registerRenders(); ModTE.registerRenders(); } What could be causing this behavior? Thanks a lot. PS: As I write this and compare with my other classes I notice I was missing the @SideOnly(Side.CLIENT) But I'm confuse... If the method isn't getting called, why it executes it anyway? And... Weren't we supposed to not use @SideOnly(Side.CLIENT) anymore? Once again, thanks for any clarification about this
July 24, 20178 yr 24 minutes ago, American2050 said: But I'm confuse... If the method isn't getting called, why it executes it anyway? And... Weren't we supposed to not use @SideOnly(Side.CLIENT) anymore? It's not that the method is being executed. It's just that Java (tries to) load all the classes it finds references to when it loads one class - so as soon as it tries to load your ModTE class in order to call the init method, it goes through the whole class and finds references to some which it can't find (because they aren't present on the server) and crashes immediately. @SideOnly is okay to use in the right circumstances, but because of the way Java loads things it's safest to keep client and server side code in completely separate classes - putting a side annotation on a method is not completely reliable.
July 24, 20178 yr Author 2 hours ago, Jay Avery said: It's not that the method is being executed. It's just that Java (tries to) load all the classes it finds references to when it loads one class - so as soon as it tries to load your ModTE class in order to call the init method, it goes through the whole class and finds references to some which it can't find (because they aren't present on the server) and crashes immediately. @SideOnly is okay to use in the right circumstances, but because of the way Java loads things it's safest to keep client and server side code in completely separate classes - putting a side annotation on a method is not completely reliable. Thanks a lot, will start to do that from now on so I avoid this problems.
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.