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

So , well my onTick(TickEvent) function doens't work, I don't know why, the other 2 events in the same class work just fine.

 

Code:

EventHandler:

 

 

package defence.mc.craftyutils;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiMainMenu;
import net.minecraft.client.gui.GuiMultiplayer;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraftforge.client.event.GuiOpenEvent;
import net.minecraftforge.event.entity.living.LivingDeathEvent;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import defence.mc.craftyutils.items.ItemLambRaw;

public class EventHandlerCraftyUtils {

@SubscribeEvent
public void onEntityDeath(LivingDeathEvent par1LivingDeathEvent) {
	if (par1LivingDeathEvent.entityLiving instanceof EntitySheep) {
		if (par1LivingDeathEvent.entityLiving.isChild()) {
			par1LivingDeathEvent.entityLiving.dropItem(ItemLambRaw.item, 1);
		}
	}
}

@SubscribeEvent
@SideOnly(Side.CLIENT)
public void onGuiOpen(GuiOpenEvent par1GuiOpenEvent) {
	if (par1GuiOpenEvent.gui instanceof GuiMainMenu) {
		CallQueue.addToQueue(new QueueElement(2) {

			@Override
			public void onCall() {
				// TODO Auto-generated method stub
				Minecraft.getMinecraft().displayGuiScreen(new GuiMultiplayer(null));
			}
		});

	}
} 

@SubscribeEvent
public void onTick(TickEvent par1TickEvent) {
	System.out.println("hi");
	CallQueue.onTick();
}
}

 

 

 

Main Class

 

 

package defence.mc.craftyutils;

import net.minecraftforge.common.MinecraftForge;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.Mod.EventHandler;
import cpw.mods.fml.common.Mod.Instance;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
import defence.mc.craftyutils.server.CommonProxy;

@Mod(modid="CraftyUtils", name="Crafty Utils", version="r0")
public class CraftyUtils {

@Instance(value="CraftyUtils")
public static CraftyUtils instance;

@SidedProxy(clientSide="defence.mc.craftyutils.client.ClientProxy", serverSide="defence.mc.craftyutils.server.CommonProxy")
public static CommonProxy proxy;

@EventHandler
public void preInit(FMLPreInitializationEvent event) {
	MinecraftForge.EVENT_BUS.register(new EventHandlerCraftyUtils());
}

@EventHandler
public void load(FMLInitializationEvent event) {
	proxy.registerRenderers();

	Utils.addItems();
	Utils.addBlocks();
	Recipes.add();
}

@EventHandler
public void postInit(FMLPostInitializationEvent event) {

}
}

 

 

Please help!

 

-Link

TickEvent is an FML Event and has to be registered with FMLCommonHandler.instance().bus().register(new EventClass());

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.