Jump to content

Recommended Posts

Posted

How would you chat a string of text like "Hay usernamehere your version of AdditionalCrafting is out of date." I have a update checker made but how would I chat that string  to tell them.

Posted

playerInstance.sendChatToPlayer(String);

 

platerInstance is the player variable you are using xD

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

Posted

What would I use for a player varable if I want it to say AdditionalCrafting because I don't have a player varable.

 

Sorry but this is my first time with chat stuff.

Posted

Where are you calling it? if it is in a class that extends IConnectionHandler in the playerLoggedIn method you do something like this:

 

if(!MainModConfigOrBaseFile.isLatestVersion) {
    ((EntityPlayerMP) player).sendChatToPlayer("Hay " + ((EntityPlayerMP) player).username + " your version of AdditionalCrafting is out of date.");
}

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

Posted

That's the problem I have nothing that involves that I only have a mod that can tell in a variable if its in date. Is the a tutorial for this stuff?

Posted

Look at my MinePG code. Especially this class:

 

https://github.com/ModderPenguin/MinePG/blob/master/source/minepg/rpg_common/rpg/comm/ConnectionHandler.java

 

and for registering it, chuck this in your @Init method:

NetworkRegistry.instance().registerConnectionHandler(new ConnectionHandler());

 

 

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

Posted

I would do it using events:

	@ForgeSubscribe
public void VersionChecker(EntityJoinWorldEvent ev) {
	if (ev.entity instanceof EntityPlayer) {
		if (!VersionCheckerClass.isUpToDate) {
			//Get player and send chat message
		}

	}

}

But that's just my opinion

Posted

Thank you and just so I don't have to make another thread I tryed to spawn a new thread and it won't work because forge does not seem to be yielding its thread.

Posted

uhhhh.... What?

 

^^^ Agreed.... What?

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

Posted

I tryed to multithreaded my mod by putting the update checker that does the checking in its own class that implients runnable so I can do new thread(UC,"updater").Start; and it would run on a second thread it starts the thread but then it stops before it can check my version off my github Version-1.5.txt file.

Posted

You do not need a new thread for that. Just use the one that minecraft is already using. There is no need for a new thread.

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

Posted

I was going to use a new thread because other wise I would need a tick handler of something of that sort so every hour I would output That it was out of date to a server counsel.

Posted

Ohhhhhhh......I though we were talking about the player? There are tutorials regarding TickHandlers out there. Is there a reason why you did not want to go that route?

Posted

Because I know how to use multithreading and I did no want to have to learn something new when I need to get this version out in 2 days to meet my goal of 1.0.0 of additional crafting.

Posted

Then your cutting it off before it can fully operate. A flaw with your code or not I am not sure.... As I cannot see it xD

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

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.