Jump to content

Recommended Posts

Posted

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... 

Posted (edited)

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 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.

Posted
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. 

Posted
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.

Posted

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.

Posted

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.

Posted (edited)

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 by Awesome_Spider

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.