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

I'm trying to register spawn eggs for some vanilla mobs that don't currently have them (specifically EnderDragons, IronGolems, WitherBosses and Snowmen).

 

I tried to re-register them with EntityRegistry#registerGlobalEntityID but I get an error saying that it was already registered. Plus, doing that seems like a bad idea to begin with.

 

Do I have to create a new item type for spawning them? Or can I just add standard eggs for them another way?

Sorr Iy only have the FML 1.8 environment on my pc so this *may* be different- but check the internal class EntityEggInfo.class in the EntityList.class. There's an addMapping() method that adds the entity egg to the list of possibilities with the egg color and such

I think its my java of the variables.

  • Author

Thanks RANKSHANK that's what I had tried before, but you gave me another idea when you said that. You can't register something twice, but I went to look at the code where the entity gets registered. [embed=425,349]EntityRegistry.registerGlobalEntityID(Class <? extends Entity > entityClass, String entityName, int id, int backgroundEggColour, int foregroundEggColour)[/embed] actually calls [embed=425,349]EntityList.addMapping(Class p_75614_0_, String p_75614_1_, int p_75614_2_, int p_75614_3_, int p_75614_4_)[/embed]. That appends a value to a static ArrayList within [embed=425,349]EntityList[/embed] called [embed=425,349]entityEggs[/embed]. So, to add a new egg manually for an entity that already exists, I figured out you can do this:

 

[embed=425,349]net.minecraft.entity.EntityList.entityEggs.put(Integer.valueOf(63), new EntityList.EntityEggInfo(63, 1, 0));[/embed]

 

I'll leave this thread open for a bit in case someone else has a better way or a question. Thanks for the reply!

  • Author

Although this works fine when running from eclipse, I get NoSuchField exceptions when trying to access the same ArrayList after exporting the mod. Does anyone know why this could be?

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.