Jump to content

[1.7.2] denying all mob spawns


nbdyhr

Recommended Posts

So I want to deny all mob spawns, so that i can add in specific mobs to each biome.

I've already tried handling this event.

 

@SubscribeEvent

public void onCheckSpawn(LivingSpawnEvent.CheckSpawn event)

{

event.setResult(Result.DENY);

}

 

but it doesn't work, am i missing something?

i want to avoid despawning if possible and just deny the spawn from occurring in the first place.

 

Link to comment
Share on other sites

Does any know how the LivingSpawnEvent.CheckEvent actually works, in the code it has this

 

    /**

    * Fires before mob spawn events.

    *

    * Result is significant:

    *    DEFAULT: use vanilla spawn rules

    *    ALLOW:  allow the spawn

    *    DENY:    deny the spawn

    *

    */

 

sounds like what I'm after but it doesn't work, as in mobs continue to spawn like normal, is this a bug, or am i using it wrong?

println confirms that it is being called, but it doesn't deny any spawns.

 

 

Link to comment
Share on other sites

ok so now i have this in the main class file

 

@EventHandler

public void init(FMLInitializationEvent event)

    MinecraftForge.EVENT_BUS.register(new NGUEventHandler());

    FMLCommonHandler.instance().bus().register(new NGUFMLHandler());

}

 

and this in a new class file.

 

public class NGUFMLHandler {

 

@SubscribeEvent

public void onLivingSpawnCheckSpawn(LivingSpawnEvent.CheckSpawn event)

{

System.out.println("denied");

event.setResult(Result.DENY);

}

 

problem is it never gets called!

Link to comment
Share on other sites

because i have other events handled there, but i tried commenting it out anyway and posting the event to postInit, preInit and load, none of which were being called.

 

looks like i'll just have to use the EntityJoinWorldEvent and cancel it when necessary.

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.