Jump to content

[1.12.2] Bit of help with removing baby zombies?


Kemanorel

Recommended Posts

Myself and the group I play with heavily dislike baby zombies so I decided to try to remove them. However, whenever I test it by spawning a bunch of zombies, I still get a few babies in there. This is the code being used.

Spoiler

package kemanorel.nomorebabyzombies.common;

import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventHandler;
import net.minecraftforge.fml.common.event.FMLInitializationEvent;

@Mod (modid = CancelBabyZombies.MODID, name = CancelBabyZombies.NAME, version = CancelBabyZombies.VERSION)
public class CancelBabyZombies {
    public static final String MODID = "nomorebabyzombies";
    public static final String NAME = "No More Baby Zombies";
    public static final String VERSION = "1.0"; 
    
    @EventHandler
    public void init(FMLInitializationEvent event) {
        MinecraftForge.EVENT_BUS.register(new SpawnHandler());
    }
}

 

Spoiler

package kemanorel.nomorebabyzombies.common;

import net.minecraft.entity.monster.EntityMob;
import net.minecraft.entity.monster.EntityZombie;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;

public class SpawnHandler {
    @SubscribeEvent
    public void onEntitySpawn(LivingSpawnEvent event) {
        if (event.getEntity() instanceof EntityMob)
            if (event.getEntity() instanceof EntityZombie) {
                EntityZombie zombie = (EntityZombie)event.getEntity();
                if (zombie.isChild())
                    zombie.setChild(false);
            }
    }
}

 

 

Link to comment
Share on other sites

  • 3 years later...
On 2/22/2019 at 2:42 AM, quadraxis said:

Forge already provides a config option:

# Chance that a zombie (or subclass) is a baby. Allows changing the zombie spawning mechanic.
D:zombieBabyChance=0.05

 

hello, i'm planning to play offline survival game without baby zombie in 1.16.5. i can't find mods nor any settings available to disable these baby zombies from spawning.

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.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.