Jump to content

Contributing to Forge? (dealing with patch files - what are they relative to?)


Raekye

Recommended Posts

I'm starting to look at Forge code. At the moment, there are some events I want to add (like on block destroy). I know and can read the code (ie: follow conventions), but have no idea how to deal with the patch files (in this case - to add the EVENT_BUS.post... call). I know how patch files work, but what are the line numbers relative to? I got regular MCP and decompiled the vanilla source, but the line numbers seem to point at totally different places. Any pointers would be greatly appreciated.

Link to comment
Share on other sites

I'm starting to look at Forge code. At the moment, there are some events I want to add (like on block destroy). I know and can read the code (ie: follow conventions), but have no idea how to deal with the patch files (in this case - to add the EVENT_BUS.post... call). I know how patch files work, but what are the line numbers relative to? I got regular MCP and decompiled the vanilla source, but the line numbers seem to point at totally different places. Any pointers would be greatly appreciated.

Link to comment
Share on other sites

Thanks. Any idea why block destroy events are rejected? Do you know what's the alternative (how are we supposed to 'listen' to these events; it seems like a lot of people want it if it keeps getting brought up)

 

Okay, so this is what I did

 

1. Clone MinecraftForge/MinecraftForge

2. Rename MinecraftForge to just 'forge', not sure why this is needed (everything should be accessible by relative paths... this is the root folder), but I haven't tried not naming it forge :P and I trust diesieben

3. Delete FML

4. Clone MinecraftForge/FML (rename to lowercase fml to be safe) into the forge root

5. To "initialize the FML submodule" I followed these steps: https://github.com/MinecraftForge/FML/wiki/If-you-want-to-contribute-to-FML

8. For fmlbuild.properties, I set the dev home to FML and the mcp home to {dev home}/mcp

9. Run ant setupenvironment

10. Run .\fml\python\python_fml setup.py

11. Got an eclipse folder under fml (set this as my eclipse workspace)

12. There are two projects - Clean and FML. I belive you don't touch clean (can someone confirm?). Inside FML, there is mc-client, fml-client, and fml-common. I also think mc-client is actually mc-client and "mc-server" (the distinction was removed in Forge 7.7)

 

However, in all the minecraft files (Clean project => src, FML => mc-client) the class names and packages are there but all the variables and function names are still obfuscated (eg: func_71934_m (method), field_72995_K (instance var), p_71908_2_ (parameter), k1 (local var)). Any ideas how to fix this?

 

Here's what I did first, think I got a better setup now so I hid it

 

1. Clone MinecraftForge/MinecraftForge

2. Rename MinecraftForge to just 'forge', not sure why this is needed (everything should be accessible by relative paths... this is the root folder), but I haven't tried not naming it forge :P and I trust diesieben

3. Delete FML

4. Clone MinecraftForge/FML (rename to lowercase fml to be safe) into the forge root

5. To "initialize the FML submodule" I followed these steps: https://github.com/MinecraftForge/FML/wiki/If-you-want-to-contribute-to-FML

6. Make a copy of "fmlbuild.properties-sample" - rename it to "fmlbuild.properties"

7. Change the dev root property to point to my forge folder (not FML)

8. Change the mcp home folder to ${default.dev.home}/mcp (did this because in the "distributed" forge mcp under forge, but at the end of it I see mcp was created in the fml folder (although everything else is too)

9. (The FML wiki steps summarized) Install ANT

10. Run ant setupenvironment

11. Copy the install scripts from the install folder (inside forge folder) to your forge root (up one level)

12. Run install.cmd or install.sh or install.py

13. Got an eclipse folder under fml (set this as my eclipse workspace)

14. There are two projects - Clean and FML. I belive you don't touch clean (can someone confirm?). Inside FML, there is mc-client, fml-client, and fml-common. I also think mc-client is actually mc-client and "mc-server" (the distinction was removed in Forge 7.7)

 

Now when I look at the mc-client sourcecode in eclipse only a few of the name mappings have been applied. Any suggestions what I did wrong?

 

I also noticed MinecraftForge's gitignore has these entries

/mcp/

/eclipse/

 

And my MCP and eclipse are under /fml (folder structure)

 

- forge root (named 'forge')

--- client, common, install, patches, ...

--- fml

----- bin, client, common, conf, patches, eclipse, ...

----- fmlbuild.properties, update_patches.bat, ...

----- mcp

------- jars, lib, source, src-base, src-work, mcp shell script files

 

And my fmlbuild.properties

default.dev.home=forge root

default.mcp.home=${default.dev.home}/mcp

 

It seems like I did something wrong setting up which file goes where, because stuff was duplicated in FML and Forge (although diesieben you say your eclipse is under fml too). I'll play around with it later, but if anyone has suggestions they'd be greatly appreciated.

 

Link to comment
Share on other sites

Thanks. Any idea why block destroy events are rejected? Do you know what's the alternative (how are we supposed to 'listen' to these events; it seems like a lot of people want it if it keeps getting brought up)

 

Okay, so this is what I did

 

1. Clone MinecraftForge/MinecraftForge

2. Rename MinecraftForge to just 'forge', not sure why this is needed (everything should be accessible by relative paths... this is the root folder), but I haven't tried not naming it forge :P and I trust diesieben

3. Delete FML

4. Clone MinecraftForge/FML (rename to lowercase fml to be safe) into the forge root

5. To "initialize the FML submodule" I followed these steps: https://github.com/MinecraftForge/FML/wiki/If-you-want-to-contribute-to-FML

8. For fmlbuild.properties, I set the dev home to FML and the mcp home to {dev home}/mcp

9. Run ant setupenvironment

10. Run .\fml\python\python_fml setup.py

11. Got an eclipse folder under fml (set this as my eclipse workspace)

12. There are two projects - Clean and FML. I belive you don't touch clean (can someone confirm?). Inside FML, there is mc-client, fml-client, and fml-common. I also think mc-client is actually mc-client and "mc-server" (the distinction was removed in Forge 7.7)

 

However, in all the minecraft files (Clean project => src, FML => mc-client) the class names and packages are there but all the variables and function names are still obfuscated (eg: func_71934_m (method), field_72995_K (instance var), p_71908_2_ (parameter), k1 (local var)). Any ideas how to fix this?

 

Here's what I did first, think I got a better setup now so I hid it

 

1. Clone MinecraftForge/MinecraftForge

2. Rename MinecraftForge to just 'forge', not sure why this is needed (everything should be accessible by relative paths... this is the root folder), but I haven't tried not naming it forge :P and I trust diesieben

3. Delete FML

4. Clone MinecraftForge/FML (rename to lowercase fml to be safe) into the forge root

5. To "initialize the FML submodule" I followed these steps: https://github.com/MinecraftForge/FML/wiki/If-you-want-to-contribute-to-FML

6. Make a copy of "fmlbuild.properties-sample" - rename it to "fmlbuild.properties"

7. Change the dev root property to point to my forge folder (not FML)

8. Change the mcp home folder to ${default.dev.home}/mcp (did this because in the "distributed" forge mcp under forge, but at the end of it I see mcp was created in the fml folder (although everything else is too)

9. (The FML wiki steps summarized) Install ANT

10. Run ant setupenvironment

11. Copy the install scripts from the install folder (inside forge folder) to your forge root (up one level)

12. Run install.cmd or install.sh or install.py

13. Got an eclipse folder under fml (set this as my eclipse workspace)

14. There are two projects - Clean and FML. I belive you don't touch clean (can someone confirm?). Inside FML, there is mc-client, fml-client, and fml-common. I also think mc-client is actually mc-client and "mc-server" (the distinction was removed in Forge 7.7)

 

Now when I look at the mc-client sourcecode in eclipse only a few of the name mappings have been applied. Any suggestions what I did wrong?

 

I also noticed MinecraftForge's gitignore has these entries

/mcp/

/eclipse/

 

And my MCP and eclipse are under /fml (folder structure)

 

- forge root (named 'forge')

--- client, common, install, patches, ...

--- fml

----- bin, client, common, conf, patches, eclipse, ...

----- fmlbuild.properties, update_patches.bat, ...

----- mcp

------- jars, lib, source, src-base, src-work, mcp shell script files

 

And my fmlbuild.properties

default.dev.home=forge root

default.mcp.home=${default.dev.home}/mcp

 

It seems like I did something wrong setting up which file goes where, because stuff was duplicated in FML and Forge (although diesieben you say your eclipse is under fml too). I'll play around with it later, but if anyone has suggestions they'd be greatly appreciated.

 

Link to comment
Share on other sites

Ah, didn't know about that. Anyways, it seems to be working great! I've got a couple more questions if you don't mind... firstly, what can I do instead if they don't allow destroy block hooks? I would guess something to do with asm but I don't see how I could add a hook that way. Or were the rejections just a matter of bad implementation?

 

Here are my steps in case anyone else stumbles on this...

1. git clone --recursive [email protected]:MinecraftForge/MinecraftForge.git forge

2. (The last argument above clones into a forge folder). I haven't tried not naming the root forge folder 'forge', I want to try later

3. Run terminal or command prompt in the forge folder, and do something like

.\fml\python\python_fml.exe setup.py

or

python setup.py

. This does the fml setup stuff too

4. The eclipse folder is in the forge root folder

Link to comment
Share on other sites

Ah, didn't know about that. Anyways, it seems to be working great! I've got a couple more questions if you don't mind... firstly, what can I do instead if they don't allow destroy block hooks? I would guess something to do with asm but I don't see how I could add a hook that way. Or were the rejections just a matter of bad implementation?

 

Here are my steps in case anyone else stumbles on this...

1. git clone --recursive [email protected]:MinecraftForge/MinecraftForge.git forge

2. (The last argument above clones into a forge folder). I haven't tried not naming the root forge folder 'forge', I want to try later

3. Run terminal or command prompt in the forge folder, and do something like

.\fml\python\python_fml.exe setup.py

or

python setup.py

. This does the fml setup stuff too

4. The eclipse folder is in the forge root folder

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.