Jump to content

[1.8] How do I prevent passive mobs from generating with terrain? [SOLVED]


Recommended Posts

Posted

I'm trying to prevent the passive mobs (cows, etc.) from generating with the terrain, although I'll have them spawnable through other means later. I've run in a circle trying to figure this out. So far the only way I've found to do it is through this:

 

@SubscribeEvent
    public void onEntitySpawn(EntityJoinWorldEvent event){
        if (event.entity instanceof EntityChicken || event.entity instanceof EntityCow || event.entity instanceof EntitySheep || event.entity instanceof EntityPig || event.entity instanceof EntityRabbit || event.entity instanceof EntityWolf || event.entity instanceof EntityOcelot){
            event.setCanceled(true);
        }
    }

 

But that disables the creatures from ever spawning at all from any source. I have also tried the following, to no effect:

 

@SubscribeEvent
    public void spawnAnimals(LivingSpawnEvent.CheckSpawn event){
        if (event.entity instanceof EntityChicken || event.entity instanceof EntityCow || event.entity instanceof EntitySheep || event.entity instanceof EntityPig || event.entity instanceof EntityRabbit || event.entity instanceof EntityWolf || event.entity instanceof EntityOcelot){
            event.setCanceled(true);
            event.setResult(Event.Result.DENY);
        }
    }

    @SubscribeEvent
    public void genAnimals(PopulateChunkEvent.Populate event){
        if (event.type == PopulateChunkEvent.Populate.EventType.ANIMALS){
            event.setCanceled(true);
            event.setResult(Event.Result.DENY);
        }
    }

    @SubscribeEvent
    public void onEntitySpawn(EntityJoinWorldEvent event){
        if (event.entity instanceof EntityChicken || event.entity instanceof EntityCow || event.entity instanceof EntitySheep || event.entity instanceof EntityPig || event.entity instanceof EntityRabbit || event.entity instanceof EntityWolf || event.entity instanceof EntityOcelot){
            event.setResult(Event.Result.DENY);
        }
    }

 

So what is the proper way to do this? It looks to my research like I'd have to somehow change the spawn lists within the biome classes, and if I'm correct I have no idea how to do that. I hope I'm not correct.

Posted

I think it would be more "correct" to simply remove them from the natural spawning list.

Except that also stops them from spawning naturally, later.

Which as I understood is exactly not what OP wants.

 

The OP said he wanted them to spawn later "through other means". I understood that to mean he would spawn them explicitly. Basically nothing auto-spawned. But you're right he might have meant something else.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

Posted

My plan is to have the persistent mobs (cows, dogs, etc.) spawnable only by taming non-persistent mobs, or through creative/command methods. The only way I want them to not spawn is through terrain generation.

 

EDIT: Thank you Diesieben, that was the problem! The animals no longer spawn.

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.