Jump to content

Mob cap behaves differently than vanilla


LiftPizzas

Recommended Posts

When I run Minecraft with FML, the mob cap includes any mobs with "persistence required" flag set (if they're nametagged or have picked up a dropped item)

 

These do NOT count toward the mob cap in vanilla.

 

I'm just wondering if this is intended behavior, since it would seem that just using forge without any mods installed would behave the same way as unmodded minecraft.

Link to comment
Share on other sites

  • 2 weeks later...

Here's forge's code in World.class lines 3347 to 3366:

    /**
     * Counts how many entities of an entity class exist in the world. Args: entityClass
     */
    public int countEntities(Class entityType)
    {
        int i = 0;
        Iterator iterator = this.loadedEntityList.iterator();

        while (iterator.hasNext())
        {
            Entity entity = (Entity)iterator.next();

            if ((!(entity instanceof EntityLiving) || !((EntityLiving)entity).isNoDespawnRequired()) && entityType.isAssignableFrom(entity.getClass()))
            {
                ++i;
            }
        }

        return i;
    }

 

I can't find what calls this, but ".isNoDespawnRequired()" returns the persistenceRequired value, and this appears to be counting mobs, and those with persistence required are not counted.

 

However, in SpawnerAnimals.class, findChunksForSpawning() looks like what is doing the spawning for hostiles and animals, and it calls a countEntities function, same name as above, but with a different set of parms, which leads to this function in World.class instead:

    /**
     * Returns a count of entities that classify themselves as the specified creature type.
     */
    public int countEntities(EnumCreatureType type, boolean forSpawnCount)
    {
        int count = 0;
        for (int x = 0; x < loadedEntityList.size(); x++)
        {
            if (((Entity)loadedEntityList.get(x)).isCreatureType(type, forSpawnCount))
            {
                count++;
            }
        }
        return count;
    }

 

It appears (from what I can tell) that this is being used to apply the mob cap, and the only thing it considers is if it's a hostile type. If you apply name tags to [mob cap] hostiles or allow [mob cap] zombies to pick up an item, no other hostiles will spawn in that area while you are in Forge 1.8. (If you save the map and load it up in vanilla 1.8, other hostiles still spawn.)

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.