Jump to content

[SOLVED][1.8] Custom Mod not Natural Spawning


gottsch

Recommended Posts

Hello,

I have a custom mod which, I have registered the renderer, egg and entity for natural spawning, however, I have yet to see it actually spawn.  I have it set in the same way as a vanilla mob (zombie).  (The egg and renderer works, just not natural spawn).

 

@EventHandler
public void init(FMLInitializationEvent event) {
        // get next available id
int mobId = 0;
        do {
            mobId++;
        } while(EntityList.getClassFromID(mobId) != null);

registerModEntityWithEgg(GhoulEntity.class, "Ghoul", mobId, 0x3F5505, 0x4E6414);
// register entities for natural spawn
EntityRegistry.addSpawn(GhoulEntity.class, 100, 4, 4, EnumCreatureType.MONSTER);

// register renderers
proxy.registerRenderers();
        }

Link to comment
Share on other sites

Sorry, I forgot to add my method:

@SuppressWarnings("unchecked")
private void registerModEntityWithEgg(@SuppressWarnings("rawtypes") Class entityClass, String entityName, int mobId, int primary, int secondary) {
    EntityRegistry.registerModEntity(entityClass, entityName, mobId, Mobs.instance, 80, 3, false);
    EntityRegistry.registerEgg(entityClass, primary, secondary);
}

 

I'm using the ID generated in the calling method.  I didn't see a method that doesn't take an ID.

Link to comment
Share on other sites

I originally was using a non-global ID, however, that didn't seem to work.

 

Since each mod has it's own ID space, then the code I was using wasn't incorrect, just simply unnecessary, and shouldn't be causing any issues.  I'll update it regardless as it doesn't make sense to keep (both the id selection and the helper method), but it doesn't solve the underlying issue.

Link to comment
Share on other sites

Thanks, that did the trick.  The weird thing is I had manually constructed an array with most of all the biomes but that didn't seem to work, so I removed it altogether because I thought if not provided, the default would be all biomes.  Looking at the code - obviously not - doh!  Don't know what I screwed up before, but this works.  Thanks again.

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.