Jump to content
  • Home
  • Files
  • Docs
Topics
  • All Content

  • This Topic
  • This Forum

  • Advanced Search
  • Existing user? Sign In  

    Sign In



    • Not recommended on shared computers


    • Forgot your password?

  • Sign Up
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Registering/Using ITickHandler
Currently Supported: 1.16.X (Latest) and 1.15.X (LTS)
Sign in to follow this  
Followers 0
Draco18s

Registering/Using ITickHandler

By Draco18s, May 21, 2013 in Modder Support

  • Reply to this topic
  • Start new topic

Recommended Posts

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

Alright, I can't figure this out.

 

I'm trying to add a new HUD item and I have a class that implements ITickHandler and I've registered it with the TickRegistry, but its methods are never called!

 

I have this in my main mod class

TickRegistry.registerTickHandler(new MyGUI(), Side.CLIENT);

 

And this is my GUI class

 

package draco18s.decay.client;

import java.util.EnumSet;

import org.lwjgl.opengl.GL11;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;

import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;

public class OverhealGUI implements ITickHandler {
public Minecraft mc;


public OverhealGUI() {
	mc = Minecraft.getMinecraft();
}

@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {

}

@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
	System.out.println("Rendering GUI object");  //this never fires
	ScaledResolution scaledresolution = new ScaledResolution(mc.gameSettings, mc.displayWidth, mc.displayHeight);
	FontRenderer fontrenderer = mc.fontRenderer;
	int width = scaledresolution.getScaledWidth();
	int height = scaledresolution.getScaledHeight();
	mc.entityRenderer.setupOverlayRendering();
	if (type.equals(EnumSet.of(TickType.RENDER)))
	{
		onRenderTick();
	}
}

@Override
public EnumSet<TickType> ticks() {
	return null;
}

@Override
public String getLabel() {
	return null;
}

public void onRenderTick(){}
}

 

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 21, 2013

I don't quite get what you mean, but try looking through the Questology repo. Mainly the HUDOverlayHandler class (something like that) in the client package and some other ones that I can't remember at the time being... I know its some sort of tick handler.

  • Quote

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

Ok, I've got Questology's code, but I can't get anything to draw.

The only thing I can figure is that it's because net.minecraftforge.client.event.RenderGameOverlayEvent doesn't exist any more.

 

The function is being called, but nothing is getting drawn. :<

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 21, 2013

All I know is that you have to register it... like so:

 

MinecraftForge.EVENT_BUS.register(new HudOverlayHandler());

 

thats keeping to the questology code. Register this wherever you want it to I guess...

  • Quote

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

All I know is that you have to register it... like so:

 

MinecraftForge.EVENT_BUS.register(new HudOverlayHandler());

 

thats keeping to the questology code. Register this wherever you want it to I guess...

 

That part worked fine, the function is being called, but NOTHING IS DRAWN.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 21, 2013

Haha.... Oops. I missed that xD

 

I'm not sure why, could you show what you do have? I know you have to have a picture that needs to be drawn onto the screen. I am just not quite sure, wait.

 

Did you get rid of the if statement in front of all the code in the drawing method? I know you most likely have, but its good to be sure... And if you can post the code, I can compare it to mine.

  • Quote

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013
package draco18s.decay.client;

import org.lwjgl.opengl.GL11;

import draco18s.decay.PositiveDamage;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiIngame;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.client.event.RenderWorldLastEvent;

public class OverhealGUIHandler extends Gui {
private final Minecraft mc = Minecraft.getMinecraft();

@ForgeSubscribe
public void drawOverlay(RenderWorldLastEvent event) {
	System.out.println("Rendering");  //this prints
	mc.renderEngine.bindTexture("/mods/DecayingWorld/textures/gui/overheal.png");
	drawTexturedModalRect(244, 382, 0, 0, 162, 16);
}
}

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 21, 2013

hmm.... Maybe try keeping more of there code?

  • Quote

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

None of their code is relevant.  A large percentage of it has to do with Questology's...properties and variables.

Another good portion is drawing some text that I don't need

Of the remainder, it's what I have, plus some GUIscalar code, which shouldn't matter (except that it won't size my GUI object properly unless implemented).

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Mew    36

Mew

Mew    36

  • Dragon Slayer
  • Mew
  • Members
  • 36
  • 567 posts
Posted May 21, 2013

Right. Ok, I don't then... All I know is that mine works :/

  • Quote

I am Mew. The Legendary Psychic. I behave oddly and am always playing practical jokes.

 

I have also found that I really love making extremely long and extremely but sometimes not so descriptive variables. Sort of like what I just did there xD

Share this post


Link to post
Share on other sites

SanAndreasP    402

SanAndreasP

SanAndreasP    402

  • World Shaper
  • SanAndreasP
  • Forge Modder
  • 402
  • 1689 posts
Posted May 21, 2013

Right. Ok, I don't then... All I know is that mine works :/

Why do you extend Gui?

 

Scratch that, You need this: RenderGameOverlayEvent.Pre or RenderGameOverlayEvent.Post

not the RenderWorldLastEvent

  • Quote

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

Right. Ok, I don't then... All I know is that mine works :/

Why do you extend Gui?

 

Scratch that, You need this: RenderGameOverlayEvent.Pre or RenderGameOverlayEvent.Post

not the RenderWorldLastEvent

 

*Cough*

 

The only thing I can figure is that it's because net.minecraftforge.client.event.RenderGameOverlayEvent doesn't exist any more.

 

Untitled.png

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

diesieben07    7696

diesieben07

diesieben07    7696

  • Reality Controller
  • diesieben07
  • Forum Team
  • 7696
  • 56382 posts
Posted May 21, 2013

Your forge is way outdated. Update.

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

Your forge is way outdated. Update.

 

Can't update very far, the mod I'm writing needs to work with another mod, which is not compatible past 644 (and I'm on 639).

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

Noah_Beech    6

Noah_Beech

Noah_Beech    6

  • Creeper Killer
  • Noah_Beech
  • Members
  • 6
  • 121 posts
Posted May 21, 2013

Then get that guy to update his mod? It shouldn't be your problem...

  • Quote

This is the creator of the Rareores mod! Be sure to check it out at

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 21, 2013

Then get that guy to update his mod? It shouldn't be your problem...

 

He is updating, and when he updates I'll update my addon.  There's no point in updating my addon before the base mod updates, it would be unusable.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
Share on other sites

vandy22    2

vandy22

vandy22    2

  • Creeper Killer
  • vandy22
  • Members
  • 2
  • 224 posts
Posted May 22, 2013

May I quickly ask, how you made a addon mod. I looked around and theres like nothing on it. I tried to do it myself but the mod I was doing an addon on the files were wierd, and things werent working just right. Is there any thing you saw that shows you how to do this?

  • Quote

Share this post


Link to post
Share on other sites

Draco18s    2414

Draco18s

Draco18s    2414

  • Reality Controller
  • Draco18s
  • Members
  • 2414
  • 15998 posts
Posted May 22, 2013

May I quickly ask, how you made a addon mod. I looked around and theres like nothing on it. I tried to do it myself but the mod I was doing an addon on the files were wierd, and things werent working just right. Is there any thing you saw that shows you how to do this?

 

The parent mod needs to have an API.  Very few do, but Mystcraft does (though it's not public; I was messing around doing neat stuff before I was given the API, and a lot of what I've done I've passed back to Mystcraft as starting points for things XCompWiz was going to implement eventually anyway).

 

You might be able to get away with decompiling the original and tying into its classes, then distributing your mod without those classes, but using the required-after dependency.  I haven't tried.  It'd be messy though and subject to easy breaking if the parent mod changes its structure, etc.

  • Quote

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Share this post


Link to post
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.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  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.

    • Insert image from URL
×
  • Desktop
  • Tablet
  • Phone
Sign in to follow this  
Followers 0
Go To Topic Listing



  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • kiou.23
      Block Rotate

      By kiou.23 · Posted 8 minutes ago

      That's usually the case, always try to understand the code before copy and pasting, or else you'll get a lot of headaches later in the code's life
    • Varzac
      Forge jar file not opening

      By Varzac · Posted 34 minutes ago

      I ran Jarfix and then tried installing again with the same results. Nothing happening I even tried using winrar, but as you said nothing happened
    • BeardlessBrady
      [1.16.4] Null when OpenGUI

      By BeardlessBrady · Posted 39 minutes ago

      Ah.. Thats what I get for stopping half way through and not double checking, thanks!
    • poopoodice
      [1.16.4] Null when OpenGUI

      By poopoodice · Posted 54 minutes ago

      https://github.com/Beardlessbrady/Currency-Mod/blob/master-1.16/src/main/java/com/beardlessbrady/gocurrency/blocks/vending/VendingTile.java#L68 This should not be null.
    • -MCS_Gaming-
      Matchmaking System?

      By -MCS_Gaming- · Posted 56 minutes ago

      I'm making an fps style mod and want to implement a matchmaking system, but I have absolutely no idea where to begin. Would anyone be able to give me some pointers as to how I would go about doing this?
  • Who's Online (See full list)

    • The_Deadly_Taco
    • JackRaidenPH
    • NullDev
    • Jeldrik
    • kiou.23
    • ehbean
    • -MCS_Gaming-
    • Top_DawgsPM
    • BeardlessBrady
    • Twu
    • knees
  • All Activity
  • Home
  • Mod Developer Central
  • Modder Support
  • Registering/Using ITickHandler
  • Theme

Copyright © 2019 ForgeDevelopment LLC · Ads by Longitude Ads LLC Powered by Invision Community