Jump to content

[SOLVED][1.8]LivingSpawnEvent.SpecialSpawn not firing or i am missing something


bastetfurry

Recommended Posts

Good morning Forum :)

 

Using the latest (8.0.12.1255 as of writing this) Forge for 1.8 i try to use LivingSpawnEvent.SpecialSpawn and its parent LivingSpawnEvent.

The parent gets called perfectly, but i expected the child to fire first, which it doesn't. In fact it isn't fired at all.

The test setup is that LivingSpawnEvent prevents all mob spawning in an area around spawn, which works for natural spawning.

The problems:

- Eggs spawn mobs, which interestingly is not registered by LivingSpawnEvent or PlayerUseItemEvent.Start.

- Mob spawners spawn their mobs, which should have been caught by LivingSpawnEvent.SpecialSpawn according to the documentation.

 

(shortend) Code example of what i am doing here:

public class onMobSpawn {

@SubscribeEvent(priority=EventPriority.HIGH)
@SideOnly(Side.SERVER)
public void spawnEvent(LivingSpawnEvent event)
{
	Entity mob = event.entity;
	if(mob instanceof EntityAmbientCreature)
	{
		if(mob instanceof EntityBat)
		{
			if(laCheck.noBatsFlag(mob.posX, mob.posY, mob.posZ,helper.getFullWorldName(mob.getEntityWorld())))
			{
				event.isCanceled();
				return;
			}				
		}
	}
	if(mob instanceof EntityMob)
	{
		if(laCheck.monsterFlag(mob.posX, mob.posY, mob.posZ, helper.getFullWorldName(mob.getEntityWorld())))
		{
			event.isCanceled();
			return;
		}
	}		
}
}

public class onMobSpawnSpecial {
@SubscribeEvent(priority=EventPriority.HIGHEST)
@SideOnly(Side.SERVER)
public void spawnEventSpecial(LivingSpawnEvent.SpecialSpawn event)
{
	Entity mob = event.entity;
	Logger log = FMLLog.getLogger();
	log.info("DEBUG: mob.getName() == '" + mob.getName() + "'");	
}	
}

//In my init class
    @EventHandler
    public void init(FMLInitializationEvent event)
    {
        MinecraftForge.EVENT_BUS.register(new onMobSpawn());
        MinecraftForge.EVENT_BUS.register(new onMobSpawnSpecial());
    }

 

So what could be my mistake here. Maybe i am misinterpreting the documentation somewhere and a nudge in the right direction would be helpful.

My Minecraft coding background is hMod/Canary Classic, if that helps. ;)

SELECT signature FROM dumbsignatures WHERE forumtopic LIKE forum;

0 rows returned.

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.