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

So I want to remove some spawns but would like to do it with a loop instead of hard-coding every entity. So I'd like to loop through all the entities and remove the spawns. But my difficulty is in getting a list of all registered entities (vanilla and other mods).

 

I think EntityList is only for vanilla entities now (and any mods that still use global ids). But it seems that the list for mod entities is kept in a private map called entityRegistrations in EntityRegistry class. I can use reflection I guess but I like to know if there is a more proper way to get the list of all registered entities. Anyone know?

 

After looking at it I think I actually should approach this the other way around: instead of cycling through entities, instead cycle through all biomes and creature types? Seems that those have public methods and fields I can work with...

 

But I still am interested in the general answer -- is there a public way to get list of all registered mod entities?

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

Any mod entity will have been registered with EntityRegistry#registerModEntity which adds entries to both EntityList.classToStringMapping and EntityList.stringToClassMapping; the first has class to "mod_id.entity_name"  mappings, and the other has "mod_id.entity_name" to class mappings, so you can find it either with a name comparison or checking if the map contains the entity's class, depending on the actual implementation of whatever you are doing.

 

The EntityList should also contain all vanilla entities, as far as I understand it.

  • Author

Hmmm. You're right. For some reason I was looking at the code and thinking EntityRegistry was contained within itself. But you're right it also uses EntityList. EntityList also directly registers all the vanilla entities so I guess that is what got me thinking in the wrong path.

 

Anyway, yes it looks like the mappings are public so I can iterate through them.

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

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.