Jump to content

[1.7.10] pre mob spawn event


Ewe Loon

Recommended Posts

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/

Link to comment
Share on other sites

 

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

 

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.