Posted March 1, 20178 yr There is no easy way to find it in the game's source code, and I haven't seen one tutorial for 1.10.2 on entities. The file I have works completely fine, I just can't figure out how to register them. I know you use EntityRegistry but the method requires the mod and an ID? I don't really understand what this is necessary for...
March 1, 20178 yr EntityRegistry.registerModEntity(yourentityclass, "a name", a unique id(number), Yourmainclass.instance, The range at which MC will send tracking updates, The frequency of tracking updates, Whether to send velocity information packets as well); if you use eclipse, just hover your mouse over the method. Edited March 1, 20178 yr by Leomelonseeds Apparently I'm addicted to these forums and can't help but read all the posts. So if I somehow help you, please click the "Like This" button, it helps.
March 1, 20178 yr Author 1 minute ago, Leomelonseeds said: EntityRegistry.registerModEntity(yourentityclass, "a name", a unique id(number), Yourmainclass.instance, The range at which MC will send tracking updates, The frequency of tracking updates, Whether to send velocity information packets as well); if you use eclipse, just hover your mouse over the method. I tried this, but first of all, I don't know how to get a unique id and secondly when I type mymainclass.instance, there is no value called instance.
March 1, 20178 yr Author 3 minutes ago, diesieben07 said: Entity IDs only have to be unique within your mod, so start at 0 and go up. For the instance you can use this when inside your main mod class, otherwise make a field annotated with @Mod.Instance, see the javadocs for more info. OK, that's cool that they upgraded from what they had before with the ID. It says that annotations are not allowed in the method though, so unless I'm misunderstanding, I can't use @Mod.Instance.
March 1, 20178 yr Author I don't completely understand here. @Mod is used to initialize the mod. And, annotations can only be before methods or classes to feed information, so I don't understand how to apply this. It says it's invalid before the method, and using it before the class doesn't help a bit. I can't use any info I put into the annotation for the class, and annotations are not exactly the object that the method is looking for. I'm sorry if I'm really stupid here, but I'm trying to make sense of this. Looking at forge documentation on it gives nothing helpful, and neither does looking at the java documentation. I know what an annotation does I think. I don't understand how any of that helps me one bit.
March 1, 20178 yr Author OK, I took a look at some stuff (namely the Mod class in fml) and I saw that @Mod.Instance is it's own annotation entirely. Putting in @Mod.Instance(value = "modidhere") is the proper syntax, no? I just don't know where to put it, since everywhere I could think of putting it is invalid.
March 1, 20178 yr Your @Mod.instance goes in your main mod class above a field whose type is your mod class. If you look at this tutorial there is an example in the first code snippet. Edited March 1, 20178 yr by Awesome_Spider
March 1, 20178 yr Author Thank you very much! It's working perfectly (other than the spawn egg spawning a pig, but that's because I haven't finished it completely yet).
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.