Posted December 11, 201410 yr 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.
December 11, 201410 yr Author Yup, that helped, thanks. Anything else that could pose a trap when coming from other Minecraft modding APIs? SELECT signature FROM dumbsignatures WHERE forumtopic LIKE forum; 0 rows returned.
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.