Jump to content

Help Getting from Eclipse to Main Game


pugnation05

Recommended Posts

Hello all,

 

Allow me to describe my situation.  I have recently done a clean install of the latest Minecraft, v. 1.6.2.  I would like to make a simple modification to the Minecraft Files so that lava would behave like water, in that it is self replicating when two lava source blocks are placed diagonally from one another like water.

 

Now, let me describe as best I can the process I have used so far.

 

* Created a file on my Desktop named "Minecraft 1.6.2 Modding Files"

* Installed the Java JDK "jdk-7u25-windows-x64" and placed it in the above folder

* Installed Forge 9.10.0 Minecraft 1.6.2 and placed it in the same folder

* Installed MCP per the Install command in the forge folder

* Installed latest version of Eclipse

* Opened Eclipse and set workspace to: "C:\Users\Me\Desktop\Minecraft 1.6.2 Modding Files\forge\mcp\eclipse

 

* Navigated to and opened file "BlockFlowing.java" by following the path: "Minecraft > Source > net.minecraft.block > BlockFlowing.java"

 

* Went to the line of code (93-103, if unaltered):

 

 

            if (this.numAdjacentSources >= 2 && this.blockMaterial == Material.water)

            {

                if (par1World.getBlockMaterial(par2, par3 - 1, par4).isSolid())

                {

                    j1 = 0;

                }

                else if (par1World.getBlockMaterial(par2, par3 - 1, par4) == this.blockMaterial && par1World.getBlockMetadata(par2, par3 - 1, par4) == 0)

                {

                    j1 = 0;

                }

            }

 

 

* Did a control copy and pasted it on the line below the closing brace.

* Replaced where it says " == Material.water" with " == Materal.lava"

* Saved the file

* Ran the program in Eclipse

* Was able to make the game work as I wanted.  I could dig a 2x2x1 hole, file in two opposite corners with lava, and then the two empty corners converted to lava source blocks.

* Exited out of Eclipse

 

============

 

This is where I'm having trouble.  The next steps I took were:

 

* Open up the MCP folder under the Forge files

* Ran the Decompile .BAT file

* Ran the Recompile .BAT file

* Ran the reobfuscate .BAT file

* Opened up the reobf and minecraft folders under "forge > mcp > reobf > minecraft

* In this folder was a single file, named "apa.class"

* In a new explorer window I navigated to C:\Users\Me\AppData\Roaming\.minecraft

* From there I opened up the 1.6.2 Jar file under "versions > 1.6.2" using 7-zip

* I deleted the current apa.class file and copied the new apa.class file from the forge folder

* I deleted the META-INF folder from 7-zip

* Closed the Jar file and opened up the new minecraft launcher

* Created new creative world, but lava behaved prior to my changes, i.e. did not generate new source blocks. 

 

=========

 

I have to doubt that there is something wrong with the code, since it worked as expected in Eclipse.  I think the problem lies in somehow getting the file reobfuscated and over to Minecraft proper.  Any ideas would be greatly appreciated.

 

Thanks,

Pug

 

Link to comment
Share on other sites

Chibill:  I have no idea what that means, but if it's something you want to do, then I'd be super appreciative!

 

GotoLink: Per your advice, I uninstalled MCP from the forge folder, reinstalled, redid the code, and did the same thing I did in the OP, except I did not decompile first.  I only ran recompile and reobfuscate.  It still didn't work.

 

*Note* I did notice that I am getting the "No Scala path" error.  I'm not exactly sure what that means.

Link to comment
Share on other sites

*Note* I did notice that I am getting the "No Scala path" error.  I'm not exactly sure what that means.

 

The Scala Path error is (I think) normal. I've been getting the same error for a while and I can re/decompile, reobfuscate, ect. without a hitch.

 

Also, I have been unable to reproduce this bug. I followed your steps exactly and cannot reproduce the error.

Link to comment
Share on other sites

I do apologize.  I know the forum said this was not a Java tutorial, so I'm trying to do the best I can.  I guess I will continue to look at it on weekends when I have time and will try to see if I deviated from my original steps any.  But I do greatly appreciate you taking the time to see if you could find my error.  That's incredibly nice of you!

Link to comment
Share on other sites

The reason it works in eclipse is because it runs the game off of the source files, as you'd expect. Forge is a mod loader and does not edit base class files except where it needs to for its own purposes. That said, it will never compile base class changes. Those stay in eclipse and for good reason. If you have to change something in the vanilla code, you use reflection. If you don't know what reflection is, well you have more homework to do (Quite a bit. Reflection is an advanced topic, but there are tutorials you can copy/paste and modify to get it to work.) The short explanation is that reflection is a computer program going over its own code and changing its behavior run-time. This lets you change things that are otherwise inaccessible (private/protected classes, methods, and variables.) Reflection is very slow and should only be used to change/check things sparingly, so be careful.

 

For more advanced/heavy reflection, use the ASM provided by Minecraft Forge.

For lighter things like single variable edits/checks, you can use the ObfuscationReflectionHelper class, also provided in Minecraft Forge. An example of using one of its static methods in one of my mod's code is

ObfuscationReflectionHelper.setPrivateValue(EntityRenderer.class, Minecraft.getMinecraft().entityRenderer, 1f, "fovModifierHand", "field_78507_R");

Note that I haven't checked if that exact code is still valid since I ported my mod from 1.5.2 to 1.6.2, but the way you use it should still be, which is all that matters here.

width=336 height=83http://img836.imageshack.us/img836/1237/cooltext624963071.png[/img]

I make games, minecraft mods/plugins, and some graphic art.

 

Current Project: LoECraft - An industrial minecraft server with its own modpack and custom launcher.

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.