Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[SOLVED] GUI not updating values


Melonslise
 Share

Recommended Posts

  • Replies 98
  • Created
  • Last Reply

Top Posters In This Topic

Top Posters In This Topic

A breakpoint stops execution at that point and let's you inspect the values of local variables and fields while the code is paused.

 

 

I don't understand how to examine the variables from here. I can't find any proper tutorial

 

Which line did you put your breakpoint at.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

* Grabs a rope *

 

Remember that statement about "you are too lazy to learn this shit" - yeah, kinda comes together. Just google java tutorial (official) go step by step with code examples, then go to eclipse usage tutorials (including debugger) and learn that shit - only then - start modding.

 

Aside from that - you can just print to console (System.out) to check if onMessage is being called.

 

Seriously - this is like first thing you learn in java. Just because you "had a  little pascal" or other shit in school doesn't mean you are remotely close to being modder. You need EXTENSIVE java knowledge to write anything beyond basic. Right now you are questioning us on totally basic logical concepts on (spoiler alert) MODDER SUPPORT - which you are not.

 

I am surprised you haven't been burned to death yet :)

 

For you own good (and our sake) please - do some few-days course on java and working in IDEs. >.<

 

Question like that (longest thread in weeks about basic stuff) won't stop if you won't actually learn something.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

* Grabs a rope *

 

Remember that statement about "you are too lazy to learn this shit" - yeah, kinda comes together. Just google java tutorial (official) go step by step with code examples, then go to eclipse usage tutorials (including debugger) and learn that shit - only then - start modding.

 

Aside from that - you can just print to console (System.out) to check if onMessage is being called.

 

Seriously - this is like first thing you learn in java. Just because you "had a  little pascal" or other shit in school doesn't mean you are remotely close to being modder. You need EXTENSIVE java knowledge to write anything beyond basic. Right now you are questioning us on totally basic logical concepts on (spoiler alert) MODDER SUPPORT - which you are not.

 

I am surprised you haven't been burned to death yet :)

 

For you own good (and our sake) please - do some few-days course on java and working in IDEs. >.<

 

Question like that (longest thread in weeks about basic stuff) won't stop if you won't actually learn something.

 

Hey don't rage. When this thing with the GUI will be solved I will (probably/hopefully) not show my face around here again

Link to comment
Share on other sites

* Grabs a rope *

 

Remember that statement about "you are too lazy to learn this shit" - yeah, kinda comes together. Just google java tutorial (official) go step by step with code examples, then go to eclipse usage tutorials (including debugger) and learn that shit - only then - start modding.

 

Aside from that - you can just print to console (System.out) to check if onMessage is being called.

 

Seriously - this is like first thing you learn in java. Just because you "had a  little pascal" or other shit in school doesn't mean you are remotely close to being modder. You need EXTENSIVE java knowledge to write anything beyond basic. Right now you are questioning us on totally basic logical concepts on (spoiler alert) MODDER SUPPORT - which you are not.

 

I am surprised you haven't been burned to death yet :)

 

For you own good (and our sake) please - do some few-days course on java and working in IDEs. >.<

 

Question like that (longest thread in weeks about basic stuff) won't stop if you won't actually learn something.

 

Hey don't rage. When this thing with the GUI will be solved I will (probably/hopefully) not show my face around here again

 

The fact that you cannot even Google for some of these things properly kind of tells that you are not ready to mod.

 

You know what, Go through this, and then try modding again. It will teach you the absolute basics about java, and the most basic things you need in modding. That plus learning to Google should be your next objective if you want to continue this exercise. We would not want to be mean to you, but you are not exactly helping with that.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

 

The fact that you cannot even Google for some of these things properly kind of tells that you are not ready to mod.

 

You know what, Go through this, and then try modding again. It will teach you the absolute basics about java, and the most basic things you need in modding. That plus learning to Google should be your next objective if you want to continue this exercise. We would not want to be mean to you, but you are not exactly helping with that.

 

Will do, but let's just finish what we started.

 

Seriously?

First result on google for "eclipse debugger tutorial": http://www.vogella.com/tutorials/EclipseDebugging/article.html

 

 

It seems that the packet is being received because the value of 'amount' is 30.

Link to comment
Share on other sites

And is the value still there in the GUI?

 

Well it certainly draws "30/30"

 

I updated the GUI and added two ints.

	int currentMana = props.getCurrentMana();
	int maxMana = props.getMaxMana();

	mc.fontRenderer.drawStringWithShadow("§1" + currentMana + "/" + maxMana, 2, 2, 1)

 

and here's the debug:

 

 

It seems that they are still there

 

Link to comment
Share on other sites

I went through your Github repository, and nowhere do I see any mana consumption in any of your items.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

And you are sure the values are updated on the server? And the server sends packets with the updated values?

I'm sure that they are updated on the server since I set up prints like this in the item:

			ManaProperties props = ManaProperties.get(player);

			if (props.consumeMana(15))
			{
				System.out.println("Player had enough mana. Do something awesome!");
			}
			else
			{
				System.out.println("Player ran out of mana. Sad face.");
				props.replenishMana();
			}

 

and they are displayed correctly.

 

And as you can see in the repo all mana modifying methods have syncMana which sends packets. I have no idea why the GUI is not updated

 

I went through your Github repository, and nowhere do I see any mana consumption in any of your items.

 

ItemScrollFirebolt

Link to comment
Share on other sites

And while answering to diesieb above, answer me this. Why do you sync max mana and current mana in different packets. Why not just use one packet.

If my post helped you, please press that "Thank You"-button to show your appreciation.

 

Also if you don't know Java, I would suggest you read the official tutorials by Oracle to get an idea of how to do this. Thanks, and good modding!

 

Also if you haven't, set up a Git repo for your mod not only for convinience but also to make it easier to help you.

Link to comment
Share on other sites

You did not answer either of my questions.

Not sure if that's what you meant, but I set up a print in the IEEP under the cosumeMana()

public boolean consumeMana(int amount)
{
	if(this.currentMana >= amount)
	{
		this.setCurrentMana(this.currentMana - amount);
		System.out.println(currentMana);
		return true;
	}
	else
	{
		return false;
	}
}

 

seems to be working correctly

 

(I'm not updating the repo rn)

Link to comment
Share on other sites

I have 2 packets because I don't know how  to store 2 variables in one packet (I know I am retarded).

 

Holy fuck.  It's exactly like sending a packet with one variable, except there are two variables.

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

And then the packet with the updated value arrives on the client?

Aright, I set up this print in the handler for the message:

@Override
public IMessage onMessage(CurrentManaMessage message, MessageContext ctx) 
{
	EntityPlayer player = RunicInscription.proxy.getClientPlayer();

	int amount = message.getCurrentMana();

	System.out.println(amount);

	ManaProperties props = ManaProperties.get((EntityPlayer) player);

	props.get(player).setCurrentMana(amount);


	return null;
}

 

It seems that the correct values are coming through. I still don't understand why the GUI is not picking up the values.

Link to comment
Share on other sites

Just to end this thread I can help you via TeamViewer - debugging from github/source is kinda pointless (something is being missed here).

If you want that help send connection info here or on Skype: ernio333

 

Seriously, this thread will otherwise continue for next 4 pages and it alredy took exponentially more time (mine and others) than time needed to just do it myself.

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Follow-up:

 

Main reason was he fucked up getCurrentMana() which returned this.maxMana.

Other than that - a lot of global mistakes and conventional miss-doings - everything fixed.

 

Shit... should have done it yesterday.

 

I guess solved.

1.7.10 is no longer supported by forge, you are on your own.

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

 Share




  • Recently Browsing

    No registered users viewing this page.

  • Posts

    • You cannot do this, this will be shared between all instances of your item, client and server. I would recommend you use getGameTime instead, which will increase by 1 every tick. You can override shouldCauseReequipAnimation in your Item class to control this.
    • Here is the log. 08.12 12:25:29 [Multicraft] Starting server! 08.12 12:25:29 [Multicraft] Loaded config for "Custom JAR (Place "custom.jar" in base directory)" 08.12 12:25:31 [Multicraft] Updating eula.txt file 08.12 12:25:31 [Server] INFO WARNING: Your kernel does not support swap limit capabilities or the cgroup is not mounted. Memory limited without swap. 08.12 12:25:33 [Server] INFO 2021-12-08 12:25:33,132 main WARN Advanced terminal features are not available in this environment 08.12 12:25:33 [Server] main/INFO [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher running: args [--gameDir, ., --launchTarget, fmlserver, --fml.forgeVersion, 35.1.37, --fml.mcpVersion, 20201102.104115, --fml.mcVersion, 1.16.4, --fml.forgeGroup, net.minecraftforge, nogui] 08.12 12:25:33 [Server] main/INFO [cp.mo.mo.Launcher/MODLAUNCHER]: ModLauncher 8.0.9+86+master.3cf110c starting: java version 1.8.0_275 by Oracle Corporation 08.12 12:25:33 [Server] main/INFO [op.OptiFineTransformationService/]: OptiFineTransformationService.onLoad 08.12 12:25:33 [Server] main/INFO [op.OptiFineTransformationService/]: OptiFine ZIP file: /mods/OptiFine-1.16.4_HD_U_G7.jar 08.12 12:25:33 [Server] main/INFO [op.OptiFineTransformer/]: Target.PRE_CLASS is available 08.12 12:25:33 [Server] main/INFO [ne.mi.fm.lo.FixSSL/CORE]: Added Lets Encrypt root certificates as additional trust 08.12 12:25:33 [Server] main/INFO [mixin/]: SpongePowered MIXIN Subsystem Version=0.8.2 Source=file:/libraries/org/spongepowered/mixin/0.8.2/mixin-0.8.2.jar Service=ModLauncher Env=SERVER 08.12 12:25:33 [Server] main/INFO [op.OptiFineTransformationService/]: OptiFineTransformationService.initialize 08.12 12:25:34 [Server] main/INFO [op.OptiFineTransformationService/]: OptiFineTransformationService.transformers 08.12 12:25:34 [Server] main/INFO [op.OptiFineTransformer/]: Targets: 308 08.12 12:25:35 [Server] main/INFO [op.OptiFineTransformationService/]: additionalClassesLocator: [optifine., net.optifine.] 08.12 12:25:35 [Server] main/INFO [mixin/]: Successfully loaded Mixin Connector [vazkii.botania.common.MixinConnector] 08.12 12:25:35 [Server] main/INFO [mixin/]: Successfully loaded Mixin Connector [vazkii.patchouli.common.MixinConnector] 08.12 12:25:35 [Server] main/INFO [cp.mo.mo.LaunchServiceHandler/MODLAUNCHER]: Launching target 'fmlserver' with arguments [--gameDir, ., nogui] 08.12 12:25:36 [Server] main/FATAL [ne.mi.fm.lo.RuntimeDistCleaner/DISTXFORM]: Attempted to load class net/minecraft/client/gui/screen/Screen for invalid dist DEDICATED_SERVER 08.12 12:25:36 [Server] INFO Exception in thread "main" [12:25:36] [main/INFO] [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:39) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:54) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.LaunchServiceHandler.launch(LaunchServiceHandler.java:72) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.run(Launcher.java:82) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at cpw.mods.modlauncher.Launcher.main(Launcher.java:66) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.server.ServerMain$Runner.runLauncher(ServerMain.java:63) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.server.ServerMain$Runner.access$100(ServerMain.java:60) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1052]: at net.minecraftforge.server.ServerMain.main(ServerMain.java:57) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: Caused by: java.lang.reflect.InvocationTargetException 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at java.lang.reflect.Method.invoke(Method.java:498) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at net.minecraftforge.fml.loading.FMLServerLaunchProvider.lambda$launchService$0(FMLServerLaunchProvider.java:51) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: at cpw.mods.modlauncher.LaunchServiceHandlerDecorator.launch(LaunchServiceHandlerDecorator.java:37) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.ThreadGroup:uncaughtException:1061]: ... 7 more 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: Caused by: java.lang.ExceptionInInitializerError 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: at net.minecraft.crash.CrashReport.func_71504_g(CrashReport.java:101) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: at net.minecraft.crash.CrashReport.<init>(CrashReport.java:54) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: at net.minecraft.crash.CrashReport.func_230188_h_(CrashReport.java:425) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: at net.minecraft.server.Main.main(Main.java:91) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:644]: ... 13 more 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: Caused by: java.lang.RuntimeException: Attempted to load class net/minecraft/client/gui/screen/Screen for invalid dist DEDICATED_SERVER 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at net.minecraftforge.fml.loading.RuntimeDistCleaner.processClassWithFlags(RuntimeDistCleaner.java:71) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at cpw.mods.modlauncher.LaunchPluginHandler.offerClassNodeToPlugins(LaunchPluginHandler.java:85) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at cpw.mods.modlauncher.ClassTransformer.transform(ClassTransformer.java:120) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at cpw.mods.modlauncher.TransformingClassLoader$DelegatedClassLoader.findClass(TransformingClassLoader.java:265) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:136) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at cpw.mods.modlauncher.TransformingClassLoader.loadClass(TransformingClassLoader.java:98) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at java.lang.ClassLoader.loadClass(ClassLoader.java:351) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: at net.optifine.reflect.Reflector.<clinit>(Reflector.java:184) 08.12 12:25:36 [Server] main/INFO [STDERR/]: [java.lang.Throwable:printStackTrace:668]: ... 17 more 08.12 12:25:37 [Multicraft] Server shut down (starting) 08.12 12:25:37 [Multicraft] Restarting crashed server in 10 seconds 08.12 12:25:37 [Multicraft] Looks like a crash, check the server console. Return value: 1 08.12 12:25:37 [Multicraft] Server stopped 08.12 12:25:40 [Multicraft] Received stop command 08.12 12:25:40 [Multicraft] Server stopped   The server works without mods, but not with them. Forge is installed on the server.
    • Ah thankyou, yeah sometimes when it's not clear on the stacktrace where the problem started because of nullptrs or lambdas or something I find it quite difficult to work out where to look. Is this what caused the crash and can I simply fix it by adding something like: modEventBus.addListener(EntityAISetupManager::addEntityAttributes); to my LotbMod constructor
    • Hello, i have installed latest version of MC Forge and it don't want to start. It gives me error: somewhere in internet i found information that Forge for MC 1.17.1 don't support Java 17, but from other side Minecraft 1.18 don't support Java 8 (with JDK 17 it worked perfectly) so which version of java should I install to make it work together? When i trying to run MC with Java 8 it gives me error:  
  • Topics

  • Who's Online (See full list)

×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.