Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

is there a cancel-able event that is called just before mobs spawn, preferable also having the reason for them spawning

 

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/

  • 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

 

  • Author

Solved, thankyou jabelar

dont know how i missed that , but sometimes it takes a different viewer to see some of the stupidest mistakes

 

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.