Posted November 19, 20159 yr 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.
November 20, 20159 yr I think it would be more "correct" to simply remove them from the natural spawning list. I just use the EntityRegistry removeSpawn() method. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
November 20, 20159 yr 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/
November 21, 20159 yr Author 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.