Jump to content

[Solved] Register Entities


drok0920

Recommended Posts

Use EntityRegistry.registerModEntity in preInit to register an entity.

 

Use RenderingRegistry.registerEntityRenderingHandler(Class<T>, IRenderFactory<? super T>) in preInit from a client-only class to register an entity renderer.

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Just now, drok0920 said:

Sorry still not clear.  Can you give me an example of what i put there?

The ID of your entity which is unique to your mod. Aka "pick a bloody number."

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

2 minutes ago, Draco18s said:

The ID of your entity which is unique to your mod. Aka "pick a bloody number."

I "put a bloody number" where you said and i get an error because it wants a resource location not an int.

 

EntityRegistry.registerModEntity(1000, EntityLeadBullet.class, "", 100, GunMod.instance, 0, 1, true);

 

Edited by drok0920
Link to comment
Share on other sites

Sorry, I forgot that the ID changed from a number to a resource location.

The answer is still "make a resource location that is your entity's ID." It can be freaking anything and it doesn't bloody matter. All that matters is that it is unique within your mod.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

The ResourceLocation parameter is the registry name of your entity, which should have your mod ID as the domain and a name unique within your mod as the path. This is just like the registry name of a Block, Item or other IForgeRegistryEntry implementation.

 

The String parameter is the unlocalised name of your entity, used for translation/display purposes. I recommend using the String form of the registry name as the unlocalised name.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Ok so this is what i should do?  

EntityRegistry.registerModEntity(new ResourceLocation("modID", "leadBullet"), EntityLeadBullet.class, "leadBullet", 100, GunMod.instance, 0, 1, true);

 

Also does id matter? (where i just temporarily put 100) like is it id within the mod or within the game.

Edited by drok0920
Expanded on question
Link to comment
Share on other sites

25 minutes ago, drok0920 said:

Ok so this is what i should do?  


EntityRegistry.registerModEntity(new ResourceLocation("modID", "leadBullet"), EntityLeadBullet.class, "leadBullet", 100, GunMod.instance, 0, 1, true);

 

Also does id matter? (where i just temporarily put 100) like is it id within the mod or within the game.

 

Replace "modID" with your actual mod ID and include your mod ID in the unlocalised name (e.g. by making it the String form of the registry name ResourceLocation).

 

The numeric ID can be any number unique to your mod, though it's probably easiest if you start from 0 and increment by 1 each time you register an entity. It's used in the entity spawn packet.

 

You can see how I register my mod's entities here.

Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Link to comment
Share on other sites

Just now, Choonster said:

 

Replace "modID" with your actual mod ID and include your mod ID in the unlocalised name (e.g. by making it the String form of the registry name ResourceLocation).

 

The numeric ID can be any number unique to your mod, though it's probably easiest if you start from 0 and increment by 1 each time you register an entity.

 

You can see how I register my mod's entities here.

Ok thank you for all the help!

Link to comment
Share on other sites

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.