Posted August 12, 201411 yr is there a cancel-able event that is called just before mobs spawn, preferable also having the reason for them spawning
August 12, 201411 yr CheckSpawn is the event that fires, although it doesn't look like it has any "reason" field. Just the entity and position basically. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
August 12, 201411 yr You can get answers to buses and other aspects of using events at my tutorial here: http://jabelarminecraft.blogspot.com/p/minecraft-forge-172-event-handling.html Based on the package it is in (net.minecraftforge.event.entity.living) it is on the MinecraftForge.EVENT_BUS. You can confirm that by checking the call hierarchy which confirms it -- the post to the bus happens in the canEntitySpawn() method in the ForgeEventFactory class. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
August 12, 201411 yr Author here is my code package me.el.mcFarms; import net.minecraftforge.event.entity.living.LivingSpawnEvent; import net.minecraftforge.event.entity.living.LivingSpawnEvent.CheckSpawn; import net.minecraftforge.event.entity.player.EntityInteractEvent; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.world.BlockEvent.BreakEvent; import net.minecraftforge.event.world.BlockEvent.HarvestDropsEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent; public class EventDetector { @SubscribeEvent public void leaves(HarvestDropsEvent event){ System.out.println("EventDetector HarvestDropsEvent"); } @SubscribeEvent public void onbreak(BreakEvent event){ System.out.println("EventDetector BreakEvent"); } @SubscribeEvent private void spawnentity(CheckSpawn event) { System.out.println("EventDetector spawnentity"); } @SubscribeEvent private void spawnentity(LivingSpawnEvent event) { System.out.println("EventDetector LivingSpawnEvent"); } @SubscribeEvent private void clickentity(EntityInteractEvent event) { System.out.println("EventDetector EntityInteractEvent"); } @SubscribeEvent private void tooltip(ItemTooltipEvent event) { System.out.println("EventDetector ItemTooltipEvent"); } @SubscribeEvent public void onInteract(PlayerInteractEvent event){ System.out.println("EventDetector PlayerInteractEvent"); } } i and getting results from HarvestDropsEvent BreakEvent PlayerInteractEvent getting nothing from any others
August 12, 201411 yr Your methods are private when they should be public. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
August 12, 201411 yr Author Solved, thankyou jabelar dont know how i missed that , but sometimes it takes a different viewer to see some of the stupidest mistakes
August 12, 201411 yr Solved, thankyou jabelar dont know how i missed that , but sometimes it takes a different viewer to see some of the stupidest mistakes No problem. I had to read it a couple times myself to see it. Check out my tutorials here: http://jabelarminecraft.blogspot.com/
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.