Jump to content

  • Curse Sites
Become a Premium Member! Help
Latest News Article

How-To: Change the time of day


  • Please log in to reply
33 replies to this topic

#1

KungFuHamster

Posted 17 October 2010 - 05:06 AM

Thanks to hfs in #mcc for this one!

Prerequisites:
- Ability to decompile class files from minecraft.jar
- Ability to recompile a single java file
- Ability to reintegrate that new class file back into the original jar file


Class used: kh.class

This is not a mod that I'm redistributing.  It's a How To, to give a tiny clue as to do a very straightforward thing: reset the time of day to dawn.

Once you have decompiled kh.class, edit the kh.java file and add this in the top with the other import statements:
import org.lwjgl.input.Keyboard;

Inside the g_() method, insert the following lines before the return statement:
		if (this instanceof dm)
		{
			if (Keyboard.isKeyDown(Keyboard.KEY_F4))
			{
				ag.a(100L);
			}
		}

Every time you press F4, the time will be reset to something approximating dawn.

:SSSS: :SSSS: :SSSS: :SSSS: :SSSS:
:Notch: :SSSS: :SSSS: :SSSS:  :SSSS:

Register or log in to remove.

#2

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 05:14 AM

I attempted to open kh.class with text editors, but judging by the gibberish that filled my screen I'd say .class files need to be decompiled?

I'm a little drunk and can't be bothered with simple google searches atm, any chance you could release an already modified .class file? I realize that this is against Notch's mod rules but I'm willing to provide proof I bought the game, and no one has to you know you PM'ed me a link :iapprove:

#3

Linksbro
    Linksbro

    Zombie Killer

  • Members
  • 172 posts

Posted 17 October 2010 - 05:59 AM

Advize said:

I attempted to open kh.class with text editors, but judging by the gibberish that filled my screen I'd say .class files need to be decompiled?

I'm a little drunk and can't be bothered with simple google searches atm, any chance you could release an already modified .class file? I realize that this is against Notch's mod rules but I'm willing to provide proof I bought the game, and no one has to you know you PM'ed me a link :SSSS:

http://java.decompil...ree.fr/?q=jdgui

#4

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 06:05 AM

Linksbro said:

Advize said:

I attempted to open kh.class with text editors, but judging by the gibberish that filled my screen I'd say .class files need to be decompiled?

I'm a little drunk and can't be bothered with simple google searches atm, any chance you could release an already modified .class file? I realize that this is against Notch's mod rules but I'm willing to provide proof I bought the game, and no one has to you know you PM'ed me a link :Furnace:

http://java.decompil...ree.fr/?q=jdgui

Thanks bro, and in the unlikely case you're a girl, broette.

#5

Pixelated
  • Location: Some place in New York.
  • Minecraft: Pixlsinks

Posted 17 October 2010 - 06:20 AM

Advize said:

against Notch's mod rules

What?
NOW, with less CANCER.

#6

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 06:23 AM

Pixelated said:

Advize said:

against Notch's mod rules

What?

Quote

The one major rule:
Do not distribute anything I've made. This includes the client and the server software for the game.
This also includes modified versions of anything I've made.

Taken from http://minecraft.net/copyright.jsp

#7

Iggyhopper

Posted 17 October 2010 - 06:37 AM

Oh my god. Thank you so much.

Bookmarked this page and now I will begin making the best mod ever.

#8

natetauer

Posted 17 October 2010 - 06:54 AM

Hey I'm not really sure on how to do this, can anyone help a bit? Where/how do I put these into the kh.class file? I opened it with that java decompiler but I'm a little lost.

#9

Deku
    Deku

    Coal Miner

  • Members
  • 142 posts

Posted 17 October 2010 - 07:07 AM

natetauer said:

Hey I'm not really sure on how to do this, can anyone help a bit? Where/how do I put these into the kh.class file? I opened it with that java decompiler but I'm a little lost.

I'm with this guy, I would really like it to be light out so I could finish my wall. :/

I don't like waiting.  ._.
Posted ImagePosted ImagePosted ImagePosted ImagePosted Image

#10

Patchumz
    Patchumz

    Lapis Lazuli Collector

  • Curse Premium
  • Curse Premium
  • 971 posts
  • Location: Wonderland
  • Minecraft: Patchumz

Posted 17 October 2010 - 07:14 AM

Where does the import go? The other section of code looks pretty obvious otherwise. I dunno, but it just black screens my game when I try. (No META-INF files to be deleted)
El Psy Congroo.

#11

fotoply
    fotoply

    Redstone Miner

  • Members
  • 511 posts
  • Location: Denmark

Posted 17 October 2010 - 07:33 AM

I'm just gonna post the changes as a class file, Notch does not seem to borther.
So, I got a surprise for you!
Spoiler:

#12

Kiboney
    Kiboney

    Carpenter

  • Members
  • 59 posts

Posted 17 October 2010 - 07:46 AM

I think he means right after
public boolean g_()
    {

Might be wrong, haven't looked at the code closely.
[iapprove] Herp derp derp look a diamond derp herp  [DORE] Posted Image

#13

fotoply
    fotoply

    Redstone Miner

  • Members
  • 511 posts
  • Location: Denmark

Posted 17 October 2010 - 07:52 AM

Kiboney said:

I think he means right after
public boolean g_()
    {

Might be wrong, haven't looked at the code closely.
Yep, that is what he means :D
So, I got a surprise for you!
Spoiler:

#14

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 08:40 AM

KungFuHamster said:

Thanks to hfs in #mcc for this one!

Class used: kh.class

Add this in the top of your file with the other import statements:
import org.lwjgl.input.Keyboard;

Inside the g_() method, insert the following lines before the return statement:
		if (this instanceof dm)
		{
			if (Keyboard.isKeyDown(Keyboard.KEY_F4))
			{
				ag.a(100L);
			}
		}

Every time you press F4, the time will be reset to something approximating dawn.

:Glass: :Glass: :Flint: :Coal: :GP:
:D :White: :White: :White:  :P

So I've done this after using the decompiler linked to by "linksbro" but now I need to recompile it. I don't have any kind of jdk installed on my computer, nor do I want to. Could someone just send me the .class file with this modification already done?

#15

jezisek1
  • Location: Czech republic

Posted 17 October 2010 - 08:58 AM

Looking for the same thing as Advize. Could someone share it ? Please!
Thanks god for citricsquid !!
Posted Image

#16

kenzo47
    kenzo47

    Out of the Water

  • Members
  • 2 posts

Posted 17 October 2010 - 09:11 AM

jezisek1 said:

Looking for the same thing as Advize. Could someone share it ? Please!
Same here, I would really like the compiled version. Please post a link here. tytyty  :P

#17

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 11:38 AM

Well...you all fail. Looks like I'm downloading the JDK.

#18

zeaga
    zeaga

    Redstone Miner

  • Members
  • 585 posts
  • Location: California, United States
  • Minecraft: zeaga
  • Xbox:Zeaga

Posted 17 October 2010 - 11:49 AM

Posting the compiled version of the JAR FILE is against the rules
But what could we possibly do with a little .class file? :D
And Advise, shut the hell up, you came up with the idea to redistribute the compiled version of the file, not us.
I also speak Japanese!

#19

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 11:53 AM

zeaga said:

Posting the compiled version of the JAR FILE is against the rules
But what could we possibly do with a little .class file? :D
And Advise, shut the hell up, you came up with the idea to redistribute the compiled version of the file, not us.

Not sure what you're talking about or why you're mad at me. Maybe I offended you? My bad. Anyways, I'm dedicating the next couple of hours to applying this change to the class file. Be back in a bit.

#20

Advize
    Advize

    Void Walker

  • Members
  • 1530 posts
  • Location: Canada
  • Minecraft: Advize

Posted 17 October 2010 - 01:31 PM

I'm frustrated as all hell. After decompiling .class files to .java files and editing them, I can't seem to recompile them into .class files without getting errors. Mainly "cannot find symbol" errors. Seriously pissed off atm.

Based on my limited experience in coding, I'm guessing that the decompilation is far from perfect and causes errors I need to clean up myself, or the class file I'm editing is calling on global variables and depends on the rest of the contents of the minecraft.jar

TL;DR - Someone please send me the already compiled class file.