Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello again,

I am making an arrow-like entity which extends EntityArrow but i can figure out how to register it.  Can anyone help me?

Edited by drok0920
Solved

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.

  • Author
1 minute ago, diesieben07 said:

The ID for your entity.

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

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.

  • Author
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

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.

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.

  • Author

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

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

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.

  • Author
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!

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

Important Information

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

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.