Jump to content

Isuuses with the TickEvent


Jonnyb170

Recommended Posts

Hello Guys, im new at this Forum and my Englishskills are not the best - I´ll try my best :D

 

Yesterday I started coding with Forge a new Mod, I´ve coded 2 mods already.

Ok, I wanted do put in my EventHandler a new Event called onRenderTick, because i wanna draw a String Ingame.

in the head of the function I wrote TickEvent.RenderTickEvent e so there is a little test, wie a simple System.out.Println:

	@SubscribeEvent
public void onRenderTick(TickEvent.RenderTickEvent e){


System.out.println("the RenderTickevent fired");


}

 

 

Of course did I register the Event in my MainClass

@EventHandler
public void init(FMLInitializationEvent e)
{

MinecraftForge.EVENT_BUS.register(new tk.camperboyz.campermod.event.EventHandler());
}

 

 

If I would start Minecraft now, there is no Textoutput in the console.

I´ve did everything that I know what to do in this situation.

Does someone know what I did wrong, would be very helpful.

Thanks.

Jonnyb170

 

 

 

Edit: I use Forge 1.8.9

Link to comment
Share on other sites

try using

FMLCommonHandler.instance().bus().register(new FMLEventPlayerTick());

 

to register that event, it's a FML event

 

some more context would be:

 

public static void registerEvents()
{
	FMLCommonHandler.instance().bus().register(new FMLEventPlayerTick());	
	MinecraftForge.EVENT_BUS.register(new EventEntityConstruction());
	//MinecraftForge.EVENT_BUS.register(new EventEntityLivingUpdate());
}

 

the above method is being called in the postInit (in my case) not sure if it would do better being in the preInit but seems to still work.

 

oh the FML event I have there is:

@SubscribeEvent
public void playerTickEvent(TickEvent.PlayerTickEvent event)

Link to comment
Share on other sites

Ah very nice, Thought I still had to use the FMLCommonHandler for those type of events.

But if Jonnyb170 wishes to continue with 1.8.9 he'll have to use the outdated advice.

(I think the Hint to take here is to not make or update current outdated versions. people need to move on and code for the latest versions. people coding for older versions is why the modding community, (mostly the end users), has problems moving on.)

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.