Jump to content

[1.7.10] Using ASM to replace 1 method


TLHPoE

Recommended Posts

Hi, I'm pretty sure I need to replace a method in the World class, seeing as I don't know how else to do it.

 

I know ASM is used to make methods public, but it can also modify/replace the method itself? I've looked here for an idea on how to do it, but EventTransformer does not exist in 1.7.10.

 

So do any of you know of a tutorial that can still be used in 1.7.10?

Kain

Link to comment
Share on other sites

ASM means Access Modifyer. Only for making methods public. And its for only coremod anyway.

You should use Reflection. It can do what you want and its not too hard.

 

What you're referring to are ATs (Access Transformers).

ASM can be used to all kinds of bytecode manipulations, even go as far as removing or replacing entire classes with custom code.

 

ASM is only available for coremods and you need to know how to write code in ASM.

ATs on the other hand can be utilized by any other mod, IIRC since recent versions of Forge.

  • Like 1

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

Here's a tutorial which looks helpful:

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571568-tutorial-1-6-2-changing-vanilla-without-editing

 

Here's my coremod (updated to 1.7.10) if you want to have a reference:

https://github.com/SanAndreasP/SAPManagerPack

 

By the way, in my loading plugin class I have a @SortingIndex annotation. It makes it so that the coremod is loaded after Forge, thus you can use SRG names (like func_xxxxx_x or field_xxxxx_x) instead of worrying about the notched (like abc.a) names.

Don't ask for support per PM! They'll get ignored! | If a post helped you, click the "Thank You" button at the top right corner of said post! |

mah twitter

This thread makes me sad because people just post copy-paste-ready code when it's obvious that the OP has little to no programming experience. This is not how learning works.

Link to comment
Share on other sites

I'm replacing the computeLightValue method in the World class.

 

What I'm trying to accomplish is adding a new check for how many solid blocks and air blocks stand inbetween the the block it's computing the light value for and the block at the top that can see the sky. Then I'll use that information to somehow alter the light value so that something floating high above the air won't cast the largest shadow on earth.

Kain

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.