Jump to content

Registering/Using ITickHandler


Draco18s

Recommended Posts

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(){}
}

 

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.

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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.

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

Link to comment
Share on other sites

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);
}
}

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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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

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

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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

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.

Link to comment
Share on other sites

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.

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.

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

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.

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



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Paguyuban4d💎⚡Demo Judi Slot Terbaik Dan Terpercaya No 1
    • LINK DAFTAR : https://bit.ly/daftarpaguyuban4d Paguyuban4d💎⚡Demo 88 Slot Dewa Gacor Malam Ini: Raih Jackpot Besar dan Sensasi Seru! Sensasi Seru Bermain Slot di Paguyuban4d💎⚡Demo 88 Bro, sist, mas, adek, gokil banget nih kalo lo lagi main slot di Paguyuban4d💎⚡Demo 88! Menurut Google, tempat ini bener-bener dewa gacor malam ini. Gak percaya? Baca terus yuk! Keuntungan Bermain di Paguyuban4d💎⚡Demo 88 Kalo lo pengen jackpot besar dan sensasi seru, main di Paguyuban4d💎⚡Demo 88 adalah pilihan yang tepat! Mereka punya RTP (Return to Player) tinggi dan jackpotnya gacor banget, bro! Jadi kesempatan lo buat menang besar tuh lebih besar! Cara Deposit, Withdraw, dan Dapatkan Bonus Gimana sih cara deposit, withdraw, dan dapetin bonus di Paguyuban4d💎⚡Demo 88? Gampang bro! Cukup masukin duit ke akun lo, main sepuasnya, terus kalo menang, langsung aja tarik duitnya. Bonusnya? Wah, banyak banget, lo! Pola Bermain yang Bikin Nagih Pola bermain di Paguyuban4d💎⚡Demo 88 emang bikin nagih, bro! Setiap putaran bener-bener seru dan nggak bikin bosen. Dan yang paling asik, lo bisa main kapan aja dan di mana aja, asal ada koneksi internet! FAQ (Frequently Asked Questions): Apakah Paguyuban4d💎⚡Demo 88 aman buat dimainin? Absolut aman, bro! Mereka punya sistem keamanan yang super canggih! Bagaimana cara mendaftar jadi member? Caranya simpel banget, bro! Kunjungi situs resminya, isi data diri, dan ikuti langkah-langkahnya. Apa saja game lain yang tersedia di Paguyuban4d💎⚡Demo 88? Mereka punya berbagai macam game, termasuk slot, togel, dan live casino yang nggak kalah seru! Bagaimana cara dapetin bonus new member? Tinggal daftar, deposit, dan bonusnya langsung masuk ke akun lo. Mudah banget kan? Kesimpulan Pokoknya, kalo lo lagi nyari sensasi bermain slot yang bener-bener asli dan menguntungkan, langsung aja ke Paguyuban4d💎⚡Demo 88. Dijamin nggak nyesel, bro! Yuk, buruan gabung dan raih kemenanganmu sekarang juga!
    • EXTRAWD : Daftar Bandar Togel Online Resmi Bet 100 Perak Terbaik! Situs EXTRAWD telah memperkenalkan konsep taruhan togel online resmi termurah dari semua situs dengan hanya bet 100 perak terjangkau dengan bet 100 perak ini dunia togel online resmi yang semakin berkembang telah menjawab bahwa EXTRAWD memberikan alternatif menarik bagi para penikmat situs togel resmi tuk mencari pengalaman bermain togel online resmi terjangkau bet 100 perak tanpa mengorbankan kualitas dan keamanan. Dengan bet 100 perak termurah ini, EXTRAWD selaku situs bandar togel resmi terbaik memberikan kesempatan bagi berbagai kalangan untuk ikut serta dalam permainan togel resmi tanpa harus mengeluarkan modal besar tetapi gampang meraup cuan besar dari hadiah togel terbesar ditawarkan EXTRAWD. Sebagai bandar togel resmi, EXTRAWD menjaga reputasi dan menjunjung keadilan dengan menawarkan layanan live chat EXTRAWD transparan dan terpercaya kepada para pelanggan togel online resmi dengan sistem keamanan yang canggih, EXTRAWD memastikan bahwa setiap taruhan togel online resmi diproses dengan aman dan hasilnya benar diacak dan adil. Hal ini memberikan kepercayaan kepada para pemain dari situs bandar togel terbaik bahwa mereka bermain di situs bandar togel terbaik aman dan dapat diandalkan. Dengan taruhan di EXTRAWD selaku penyedia situs togel resmi sekaligus bandar togel resmi terjangkau bet 100 perak telah membawa permainan togel online resmi menjadi solusi situs bandar togel terbaik kepada semua pemain togel online resmi tanpa harus mengeluarkan modal besar untuk bermain togel online resmi, Ini membuka pintu bagi banyak orang sebelumnya mungkin merasa enggan mencoba peruntungan permainan di situs togel resmi, Bet 100 perak membuka kesempatan besar bagi setiap pemain untuk meraih hadiah togel terbesar di berbagai pasaran togel daftar togel resmi, merasakan hadiah togel terbesar dari hasil bet 100 perak di togel online resmi EXTRAWD dengan resiko minim namun berpotensi, Buruan nikmati kesempatan ini dan daftar togel resmi.
    • Paguyuban4d💎⚡Rtp Slot 100 Asli Orang Dalam Bocoran Admin Jarwo Bermain Slot di Paguyuban4d: Sensasi Seru dan Keuntungan Nyata Bro, sist, mas, adek, wakgenk, atau siapapun yang doyan main slot online, kalian harus tau nih tentang Paguyuban4d💎⚡Rtp Slot 100 Asli. Menurut Google, Paguyuban4d adalah tempat yang paling oke buat main slot dengan sensasi seru dan keuntungan nyata yang bener-bener asli. Keuntungan Bermain di Paguyuban4d💎⚡ Dari pada main slot di tempat lain yang cuma bikin frustasi, mendingan main di Paguyuban4d💎⚡. Mereka punya RTP (Return to Player) tinggi, jadi kesempatan menang lo lebih besar. Plus, jackpotnya gacor banget, bro! Cara Deposit, Withdraw, dan Bonus di Paguyuban4d💎⚡ Gimana sih cara deposit, withdraw, dan dapetin bonus di Paguyuban4d💎⚡? Gampang bro, lo cukup masukin duit ke akun lo, main sepuasnya, terus kalo menang, langsung aja tarik duitnya. Bonusnya? Dijamin nggak nyesel deh, banyak banget! Pola Bermain yang Bikin Nagih Pola bermain di Paguyuban4d💎⚡ emang bikin nagih, bro! Setiap putaran bener-bener seru dan nggak bikin bosen. Dan yang paling asik, lo bisa main kapan aja dan di mana aja, asal ada koneksi internet! FAQ (Frequently Asked Questions): Apakah Paguyuban4d💎⚡ aman buat dimainin? Yup, gak usah khawatir, mereka punya sistem keamanan yang super canggih! Bagaimana cara mendaftar jadi member? Caranya simpel banget, bro! Kunjungi situs resminya, isi data diri, dan ikuti langkah-langkahnya. Apa saja game lain yang tersedia di Paguyuban4d💎⚡? Mereka punya berbagai macam game, termasuk slot, togel, dan live casino yang nggak kalah seru! Bagaimana cara dapetin bonus new member? Tinggal daftar, deposit, dan bonusnya langsung masuk ke akun lo. Mudah banget kan? Kesimpulan Pokoknya, kalo lo lagi nyari sensasi bermain slot yang bener-bener asli dan menguntungkan, langsung aja ke Paguyuban4d💎⚡. Dijamin nggak nyesel, bro! Yuk, buruan gabung dan raih kemenanganmu sekarang juga!
  • Topics

×
×
  • Create New...

Important Information

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