Jump to content

onTickInGUI?


tarun1998

Recommended Posts

Came across a bug.

 

if(gui instanceof GuiMainMenu) {
		System.out.println("Hi 1");
	}
	if(gui instanceof GuiIngameMenu) {
		System.out.println("Hi 2");
	}
System.out.println("Hi 3");

 

When the game is in the main menu (where there are the Mods, Texture packs buttons) 'Hi 1' never prints to the console but when the game is paused 'Hi 2' is printing. 'Hi 3' only prints when you are playing a world or the game is paused. Any reasons why?

 

I have not modified the jars that get decompiled except add textures to em.

Link to comment
Share on other sites

If you use the latest version all ticking issues should be resolved.

If they are not, provide detailed steps and timing for exactly what you want and provide test code to demonstrate what you need.

 

Trying to emulate ML's crap ticking system in FML is a big fucking pain in the neck.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Okay so I reinstalled the latest forge source (3.3.8.164) but unfortunately 'println' in onTickInGUI only printed once which is all I need but i'm not sure if it will run the code if I quit a world. Here is the log:

 

 

27 achievements

182 recipes

LWJGL Version: 2.4.2

Jul 16, 2012 8:06:48 PM cpw.mods.fml.common.FMLCommonHandler beginLoading

INFO: Attempting early MinecraftForge initialization

Jul 16, 2012 8:06:48 PM cpw.mods.fml.common.FMLCommonHandler beginLoading

INFO: Completed early MinecraftForge initialization

2012-07-16 20:06:48 [iNFO] Forge Mod Loader version 2.2.106.176 for Minecraft c:1.2.5, s:1.2.5 loading

2012-07-16 20:06:48 [iNFO] Loading mods from /Volumes/Stuff/MCP Workshops/ThirstMod Redone/jars/mods

2012-07-16 20:06:48 [iNFO] Directory ThirstMod contained no mods

2012-07-16 20:06:48 [iNFO] Forge Mod Loader has loaded 2 mods

Loading: net.java.games.input.OSXEnvironmentPlugin

2012-07-16 20:06:49 [iNFO] MinecraftForge v3.3.8.164 Initialized

MinecraftForge v3.3.8.164 Initialized

2012-07-16 20:06:49 [iNFO] Forge Mod Loader load complete, 2 mods loaded

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

Testing....1, 2, 3

Stopping!

 

SoundSystem shutting down...

    Author: Paul Lamb, www.paulscode.com

 

 

 

As you can see 'Testing....1, 2, 3' only printed once. What I am currently doing is trying to change a value everytime a person returns from a world so that I can read from the NBT storage file if the person decides to open another world. If that value does not change some values will remain the same from the previous world. Here is the code where i am trying to accomplish this:

 

 

if(attempts == 0) {

if(player.worldObj.isNewWorld == true) {

Utilities.setDefault();

} else {

readNBT(player.getEntityData());

}

attempts = attempts + 1;

}

if(attempts == 1) {

writeTimer++;

if(writeTimer >= 200) {

writeNBT(player.getEntityData());

writeTimer = 0;

}

}

 

And in onTickInGUI i am trying to reset 'attempts' value back to 0 so that the game will read from the NBT storage when the person opens a world again. I hope you can understand me and get this issue fixed soon. BTW I have called setInGUIHook(this, true, true).

Link to comment
Share on other sites

Alright I'll use ISaveEventHandler but I still want this fixed. Here is the code:

 

 

package net.minecraft.src;

 

import net.minecraft.client.Minecraft;

 

public class mod_TestTick extends BaseMod {

 

public String getVersion() {

return "test";

}

 

public void load() {

ModLoader.setInGUIHook(this, true, true);

}

 

public boolean onTickInGUI(float tick, Minecraft game, GuiScreen gui) {

System.out.println("Testing!");

return true;

}

}

 

Testing only prints once. :( Thanks

Link to comment
Share on other sites

Shouldn't the ticks be on par with ModLoader's ticking system. Well it definitely not.

Same source but I only installed ModLoader into the jar and decompiled and guess what:

 

 

27 achievements

182 recipes

LWJGL Version: 2.4.2

ModLoader 1.2.5 Initializing...

Mod Initialized: mod_TestTick test

Done.

Loading: net.java.games.input.OSXEnvironmentPlugin

 

Starting up SoundSystem...

Initializing LWJGL OpenAL

    (The LWJGL binding of OpenAL.  For more information, see http://www.lwjgl.org)

OpenAL initialized.

 

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Testing!

Stopping!

 

SoundSystem shutting down...

    Author: Paul Lamb, www.paulscode.com

 

 

 

Testing printed every tick. :)

Also how I can read from the NBT using ISaveEventHandler when ModLoader.getMinecraftInstance.thePlayer.getEntityData is null? Sorry for all this trouble.

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.