Creating a spawn egg for my mob

77 views
Skip to first unread message

Jooby Zat

unread,
Dec 2, 2014, 10:36:55 PM12/2/14
to sams-teach-yourself-minecraf...@googlegroups.com
Hello!  I am using the book code to create a spawn egg, but I get this error:

"The type java.util.Map$Entry cannot be resolved. It is indirectly referenced from required .class files"

After doing some reading, someone said the  EntityEggInfo class is no longer used.  Is there an alternate way to create a spawn egg?

The spawn egg code I use is below::
-----------------------------------------------------

static int startEntityId = 300;

@SuppressWarnings("unchecked")
public static void registerEntityEgg(Class<? extends Entity> entity, intprimaryColor, int secondaryColor)
{
       int id = getUniqueEntityId();
       EntityList.IDtoClassMapping.put(id, entity);
       EntityList.entityEggs.put(id, new EntityEggInfo(id, primaryColor, secondaryColor));
}

public static int getUniqueEntityId()
{
       do
       {
              startEntityId++;
       }
       while (EntityList.getStringFromID(startEntityId) != null);

       return startEntityId;
}

-----------------------------------------------------------------------------------------------------------------------

Jimmy Koene

unread,
Dec 6, 2014, 5:01:28 AM12/6/14
to sams-teach-yourself-minecraf...@googlegroups.com
Hello,

Which version of forge are you using?

- Jimmy Koene

Jooby Zat

unread,
Dec 6, 2014, 10:31:41 PM12/6/14
to sams-teach-yourself-minecraf...@googlegroups.com
Thanks!  I am using Forge  Build 1.7.10-10.13.1.1223.
As it turns out, I followed another tutorial and got a spawn egg by adding the following single line of code in the Init method:

EntityList.addMapping(EntityBear.class, "Bear", 0, 113213, 3523523);

The downside is that there is no checking for an unused entity ID  (I used 0, the third input parameter above).





Message has been deleted

Janiece Renee Loyd

unread,
Jan 3, 2015, 9:12:49 AM1/3/15
to sams-teach-yourself-minecraf...@googlegroups.com
Hello, I was having the same problem. Could you send me the code for the missing class and I will try to replicate it.

corvidae...@blackfeather.biz

unread,
Mar 13, 2015, 5:36:45 PM3/13/15
to sams-teach-yourself-minecraf...@googlegroups.com
I was having the same problem, following the instructions directly from the book - I ended up resolving the problem by directly importing it:

import net.minecraft.entity.EntityList.EntityEggInfo;

This was not included in the book.

dftb...@gmail.com

unread,
Jun 21, 2015, 8:20:35 PM6/21/15
to sams-teach-yourself-minecraf...@googlegroups.com
I tried importing the class and it put the egg in the creative menu, but when I tried using the eggs, they wouldn't spawn the mob.
Reply all
Reply to author
Forward
0 new messages