Jump to content

is it possible to change a var in another mod's class?


RaptorTurkey

Recommended Posts

for example if in one mod there is
 

public void exampleMethod(){
String var5 = "foo";
drawString(mc.fontRenderer, var5, 35, 10, 0xFFFFFF);
}

in a class named exampleRender.class

within another mod, can I change that var5? or just empty the whole method? and if so, which is the easier route and which is the most efficient/least performance impacting

Link to comment
Share on other sites

No

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Link to comment
Share on other sites

8 minutes ago, RaptorTurkey said:

Well that was fast, thanks. Guess I'll need to see if the mod author will give me permission to modify it.

You should instead elaborate on your problem more, there might be a way to do what you want without having to do what you have stated.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 minutes ago, Animefan8888 said:

You should instead elaborate on your problem more, there might be a way to do what you want without having to do what you have stated.

Hmm, well that's pretty much my entire problem.

Essentially the whole method is used to render specific GUI elements when certain things happen but I wanted to make my own GUI which has turned out great however the one thing I can't hide is that drawstring, if I could change the var, it'd be great to make it just blank and I wouldn't have needed to even try overwrite the drawstring - though I know it should be possible to do it via ASM(?), however I'd need to do a lot of work to figure out where to even begin there.

 

There's a method where the render is called under certain actions, like when x keybind isn't pressed (so it's hidden on pressing tab) and there's actually a public var that I can change which does stop it from rendering, but it also stops everything else from working correctly.

Link to comment
Share on other sites

2 hours ago, RaptorTurkey said:

Hmm, well that's pretty much my entire problem.

Essentially the whole method is used to render specific GUI elements when certain things happen but I wanted to make my own GUI which has turned out great however the one thing I can't hide is that drawstring, if I could change the var, it'd be great to make it just blank and I wouldn't have needed to even try overwrite the drawstring - though I know it should be possible to do it via ASM(?), however I'd need to do a lot of work to figure out where to even begin there.

 

There's a method where the render is called under certain actions, like when x keybind isn't pressed (so it's hidden on pressing tab) and there's actually a public var that I can change which does stop it from rendering, but it also stops everything else from working correctly.

If you are making an addons for that mod and have access to the class then all you have to do is subscribe to the GuiOpenEvent and replace the Gui with your own Gui.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Link to comment
Share on other sites

2 hours ago, Animefan8888 said:

If you are making an addons for that mod and have access to the class then all you have to do is subscribe to the GuiOpenEvent and replace the Gui with your own Gui.

It's called from a client tick handler class, I can change accepted and it'll work, but it then breaks the rest of the elements of the mod, as with Pwrtyp, so I can't even break it just here

 

if (((this.dbc) || (this.nc)) && (JRMCoreH.Accepted == 1) && (!this.mc.gameSettings.keyBindPlayerList.getIsKeyPressed()) && ((JRMCoreH.Pwrtyp == 1) || ((JRMCoreH.Pwrtyp == 2) && (JRMCoreH.inIll == null))))
      {
        JRMCoreClient.bars.renderBodyBar();
}

 

in JRMCoreClient it's listed as

public static JRMCoreGuiBars bars;

and registered with
bars = new JRMCoreGuiBars();


Which would work great and I could just null bars, however

the tick handler class uses the above mentioned method specifically.

Though I'm not sure if there's a way to change bars into a different class and mimic everything, but remove the specific elements I wanted to remove? I guess that's the closest bet I've got

Link to comment
Share on other sites

4 hours ago, diesieben07 said:

If it's a public field you can just set it to contain something else...

yeah but the problem is if you look, it's a public static JRMCoreGuiBars...

it's hard coded as a JRMCoreGuiBars that's referenced as bars, so if I try say bars = ""; to blank it out then that's a string and it expects JRMCoreGuiBars since it's a predefined type?

 

Hold up brain fart, I just extended JRMCoreGuiBars in a new class and just said bars = new newclass();

Thanks for the assistance anyway

Edited by RaptorTurkey
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.