Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hi

 

So I have tried looking up how to override main (or base) classes a couple times a found nothing. Is there ANY sort of method in forge that will allow me to override any main/base classes?

 

I gave a short and to the point answer, if you need more information please ask.

 

Thanks,

~ASHninja1997

Every day is a new day to learn.

I acknowledge the hard work of original content.

I will always improve in many ways.

 

Java > c

What are you trying to accomplish?  All modding is "overriding" the base classes.

 

Generally, if you want to change behavior of base classes you should first look for public methods and fields.  For example, the AI task lists of entities are public and so you can totally replace the entity AI.

 

Secondly, you can look at events.  Forge specifically intercepts many places where modders may want to change base behavior.  You can cancel many default behaviors and replace with your own code.

 

Thirdly you can use Java reflection.  This can help you access many protected and private fields and methods directly.

 

Fourthly you can use access transformers to truly modify the way the code operates.

 

Fifthly, many things are in registries which are public and you can de-register and re-register your own version of things.

 

Lastly, you can create custom versions (meaning extend in Java) of things and replace the base versions.  Like whenever a creeper spawns you could replace it with your own custom creeper, whenever a block gets placed put your own custom block instead, and so on.

 

So there is very little reason to actually want to change the actual base classes, since you have all the techniques above to use.

Check out my tutorials here: http://jabelarminecraft.blogspot.com/

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...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.