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!

I'm just wondering if there is a mob cap? I mean so you can only have a certain amount of mobs in one mod? Because i have plenty of mobs in a mod (more than i would care to count) and im getting a crash if i spawn a mob thats later down the list: CRASH But if i spawn a mob earlier in the tab, it works fine. So yeah, im assuming its got something to do with a entity cap

Former developer for DivineRPG, Pixelmon and now the maker of Essence of the Gods

What does the crash report say?

 

If there was a cap in the coding then it probably would "fail gracefully" meaning it just wouldn't spawn or something, it shouldn't crash.  I suspect that it is some other problem.  It may be "capped" by memory available or something.  But let's see the crash report.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

The question is how do you register entities?

If you use registerGlobalEntityId(), then yes, there's a cap (AFAIK max 256 entities)

If you just use registerModEntity(), then there shouldn't be a problem.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

As SanAndreas said using that method there is a limit of 256 including all vanilla mods and including all other mods.  If you want to confirm that you've used up the amount you can print out the global ID as they are registered.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

This may sound newbish, but how would one register using the other method? I've always used that way!

It's pretty straightforward:

// I create a local index to make it easy on myself; just increment away 
int modEntityIndex = 0;

// the numbers are a) tracking range, b) frequency of tracking updates; true to send tracking updates
// see [url=https://docs.google.com/spreadsheet/pub?key=0Ap8gssssFFPAdFRXREZGSzZRY3k1WE8wcUE4S09xWXc&single=true&gid=0&output=html]this chart[/url] for typical vanilla values
EntityRegistry.registerModEntity(SomeEntity.class, "entity1name", ++modEntityIndex, YourMod.instance, 64, 10, true);
EntityRegistry.registerModEntity(AnotherEntity.class, "entity2name", ++modEntityIndex, YourMod.instance, 64, 10, true);

Keep in mind that doing it this way you will not be able to use the vanilla spawn eggs or summon command for you custom entity (thus the appeal of the global entity id, which I still don't understand why it has not been 'fixed' to allow for more than 256, such as using a String "mod:entityName" for spawn eggs rather than an integer, but I digress), so you will have to create your own spawn egg item(s) and command if you want them.

is that 256 entities per world, dimension, chunk?

Long time Bukkit & Forge Programmer

Happy to try and help

is that 256 entities per world, dimension, chunk?

 

per game :P

No seriously, it's like the old block IDs, if you register too much entities with registerGlobalEntityId(), then you can't register more.

That's what registerModEntity is for, to not have this kind of limitations.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

I get it now, I totaly misunderstood.  That is how many entity classes can exists.

 

I thought you were talking about how many spawned entities in a world.  I was getting worried something I was working on was doomed.

Long time Bukkit & Forge Programmer

Happy to try and 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.