Jump to content

[1.7.10] Adding Spawn Eggs For Mobs that Don't Have Them


novemcinctus

Recommended Posts

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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!

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.