Jump to content

[Newb Question] Changing Minecraft's Classfiles with a Forge Mod


BobTheLawyer

Recommended Posts

Hello,

So I had an idea to make a simple mod that involves changing the levels required in order to use an anvil.  I'd assume that I can just change some class files and it would work well.  Most mods for forge do not seem to describe altering these class files as a possibility.  They all seem to focus on the creation of new content rather than modifications, as the name mod implies is possible. 

 

How would I go about making this mod for forge?  I have plenty of java experience, but no minecraft modding experience. 

 

Thanks,

BobTheLawyer

Link to comment
Share on other sites

Many Forge mods alter vanilla behaviors and characteristics using hooks that Forge provides, such as the wonderful @SubscribeEvent system.

 

Most mods do not directly alter any vanilla class files; those that do tend to use what's known as byte code manipulation to dynamically modify the .jar file so that their mod is more likely to be compatible with others.

 

99.9999999% of the time, you do not need to modify any vanilla class files.

 

In your case, Forge provides the AnvilUpdateEvent; this has a public field called 'cost' which is the amount of levels the transaction requires, and you can listen to the event, check the anvil contents, and modify the cost to whatever you want.

 

If you truly do have plenty of Java experience, then once you get a basic modding workspace set up, this should be pretty straightforward for you to accomplish.

Link to comment
Share on other sites

Many Forge mods alter vanilla behaviors and characteristics using hooks that Forge provides, such as the wonderful @SubscribeEvent system.

 

Most mods do not directly alter any vanilla class files; those that do tend to use what's known as byte code manipulation to dynamically modify the .jar file so that their mod is more likely to be compatible with others.

 

99.9999999% of the time, you do not need to modify any vanilla class files.

 

In your case, Forge provides the AnvilUpdateEvent; this has a public field called 'cost' which is the amount of levels the transaction requires, and you can listen to the event, check the anvil contents, and modify the cost to whatever you want.

 

If you truly do have plenty of Java experience, then once you get a basic modding workspace set up, this should be pretty straightforward for you to accomplish.

Thank you for your reply!  This is exactly what I needed to know :)
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.