Jump to content

Is there a Forge hook to modify base classes?


MagnusCaligo

Recommended Posts

I have done research into this and I haven't found a clear answer yet. I need to make a few changes to the NibbleArray class and a bunch of other classes and I wanted to know if there was a method of doing this with forge rather than going into the base classes and directly making the changes.

 

If there are any methods to doing this, what are they?

Link to comment
Share on other sites

There are coremods, however you should not make one.

It's not a modder's responsibility to edit the core of minecraft.

It's Forges, if you have issues make a PR and we'll discuss it.

99% of the time your edits are not needed and can be done in better ways then editing the base classes.

0.9% of the time, your changes need to be cleaned up to maintain compatibility with other mods/systems.

The other 0.1% of the time is a myth, it never happens.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

I for one support the SledgeHammer approach to modding thoroughly!

Snip - User was banned for 7 days for advocating breaking EVERYTHING because he is to lazy to learn to do things the correct way. -Lex

"you seem to be THE best modder I've seen imo."

~spynathan

 

ლ(́◉◞౪◟◉‵ლ

Link to comment
Share on other sites

For those who think they need to edit base classes, they need to check out the following first -- i.e. tons of ways to create mod without editing base classes. I usually look for approaches in the following order:

 

1) Public fields and methods already available. There are tons of vanilla fields and methods that are already public. For example, the AI task lists for all vanilla mods are fully modifiable directly.

2) Registries, Ore Dictionary, substitution aliases. There are multiple Forge mechanisms which allow you to access the available items, blocks and entities and replace them or delete them.

3) Events. There are more and more great events that allow you to intercept the vanilla processing and replace with your own code.

4) Reflection. Java allows exposing the private fields and methods of vanilla classes through reflection. Although theoretically there is a performance impact to this, it is in most cases insignificant. Once you can access the private fields and methods of a class, you certainly have a lot of control.

5) Access transformers, ASM, other advanced methods. Honestly I have never had much reasons to get to the point where i needed these.

 

So, to the OP the question is really: what are you trying to achieve with your edits?

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

Link to comment
Share on other sites

I need to add a few extra methods to the NibbleArray class to take a fourth parameter, is there any way to do this with any of those methods provided? I have never heard of Reflection and I have never used Access transformers so I don't know how those could potentially help me

 

Link to comment
Share on other sites

[lmgtfy]Java reflection tutorial[/lmgtfy]

 

But really, you don't want to edit base classes, you really don't, or else you will turn out like this guy. Don't be that guy.

 

 

Why exactly do you want to edit nibblearray, because 99% of the time, there is already something that can do what you want. If you happen to fall in that 1% you can make a request to have forge add this.

Link to comment
Share on other sites

I need to edit the nibblearray because i'm essentially trying to add a 4th dimension to minecraft. I need to modify a lot of the base classes and so far I haven't found any forge hooks that let me do what I want to do... I think I might have to abandon using forge because (while it is useful for a lot of smaller mods) mine requires editing a lot of stuff to the base game. So, I need to change the way the world generates so that it uses 5th dimensional simplex noise, I need to completely rework the way minecraft renders (which I'm not sure how it does this yet, but I figure im going to have to make changes to its rendering pipeline because I doubt it is going to work the way I need it to), and i'm going to need to change the way the physics works, and the way block data is stored... This is a massive project, and I have worked in 4D before, I just don't understand a lot of Minecraft's code because of how poorly documented it is. I figured I would start with the nibble array and the chunks just to make sure I can get them to be able to handle a 4th dimension, then I would start to work on the rest... I don't know a lot about forge because I have never worked with it, but if anyone could tell me some forge hooks that could possible help me with this so I don't have to go and edit all the base files myself.

Link to comment
Share on other sites

There are HUNDREDS and I mean HUNDREDS of tutorials online on how to make a custom dimension. There are ways with forge to make custom renders, again quick google search. If you have any problems with making a custom dimension, then ask us that, as you should NEVER need to modify base classes. Not using forge loses you access to compatibility with other mods, and the whole forge API. Forge is not only for small mods, many large mods would be very difficult to make without forge. One of these mods would be Aether II (which adds a dimension).

Link to comment
Share on other sites

There are HUNDREDS and I mean HUNDREDS of tutorials online on how to make a custom dimension.

 

Thats the thing though, i'm not trying to make a dimension such as the Nether or End or Aether, i'm trying to add a 4th Spatial Dimension... In minecraft you can only move up down (1 Dimension), left right (1 Dimension), forward and backward(1 Dimension, arriving at a total of 3 Dimensions in which you can travel)... I want to make a mod that would allow you to travel in a fourth Spatial Dimension, not another world like the End or Nether

Link to comment
Share on other sites

There are HUNDREDS and I mean HUNDREDS of tutorials online on how to make a custom dimension.

 

Thats the thing though, i'm not trying to make a dimension such as the Nether or End or Aether, i'm trying to add a 4th Spatial Dimension... In minecraft you can only move up down (1 Dimension), left right (1 Dimension), forward and backward(1 Dimension, arriving at a total of 3 Dimensions in which you can travel)... I want to make a mod that would allow you to travel in a fourth Spatial Dimension, not another world like the End or Nether

 

Ahh.. Ok, I understand now. Can't help you there, but someone else could.

Link to comment
Share on other sites

Thats the thing though, i'm not trying to make a dimension such as the Nether or End or Aether, i'm trying to add a 4th Spatial Dimension... In minecraft you can only move up down (1 Dimension), left right (1 Dimension), forward and backward(1 Dimension, arriving at a total of 3 Dimensions in which you can travel)... I want to make a mod that would allow you to travel in a fourth Spatial Dimension, not another world like the End or Nether

That's not possible without editing base classes. You could do it with heavliy ASM maybe, but not recommended. Maybe you should make the mod without Forge, but maybe you should instead just ditch Minecraft and instead make a game about it, based on Minecraft. If you want to do this; you're mod will end up like

Better than wolfs mod

or

Ather 2

. If you're going to edit base classes without forge, you're mod won't work with any other mod.

I might be terribly wrong.. Like really, really wrong. But I'm just trying to help.

Link to comment
Share on other sites

There are HUNDREDS and I mean HUNDREDS of tutorials online on how to make a custom dimension. There are ways with forge to make custom renders, again quick google search. If you have any problems with making a custom dimension, then ask us that, as you should NEVER need to modify base classes. Not using forge loses you access to compatibility with other mods, and the whole forge API. Forge is not only for small mods, many large mods would be very difficult to make without forge. One of these mods would be Aether II (which adds a dimension).

What he wanted to implement is cannot be obtained in those ways. If he create custom dimensions for generating 4-dimensional world, it will be really buggy because every time he want to generate something he would need communication between dimensions which would be very heavy in terms of performance.

I don't know how he can achieve, but if it can be achieved by changing NibbleArray and nothing much more than that, it would be okay.

 

@OP

So how many changes do you need?

I. Stellarium for Minecraft: Configurable Universe for Minecraft! (WIP)

II. Stellar Sky, Better Star Rendering&Sky Utility mod, had separated from Stellarium.

Link to comment
Share on other sites

@OP

So how many changes do you need?

 

I would have to make a lot of changes... I'm considering just ditching Forge and doing this on my own if there isn't a way to do it with Forge hooks.

maybe you should instead just ditch Minecraft and instead make a game about it, based on Minecraft.

 

I was hoping not to ditch minecraft because it has so many features that I don't want to have to rewrite myself.

 

My new question is if I do edit that base classes and I make them backward compatible, is there any way to "replace" the old base classes with my own? Kinda like when minecraft modding first came out and you had to manually drag files into the .jar files? Because if that is still possible I might be able to make it work with forge... maybe... i'm not sure... as long as its backwards compatible it should work... right?

 

The way I intend to make the changes isn't really by changing any of the core methods or functions (well, I hope I don't have to make any changes. I haven't started working on the mod yet because I wanted to see if anyone could provide a solution so that I could use forge before I started working). Instead I intend to add my own functions and change just a few bits in the core basses (such as when you request a block meta data at x,y,z you instead request the meta data x,y,z,w, etc) and unless someone else ALSO wrote a mod for forge with modifying the base classes, then it would still work right? Because anything that calls the x,y,z methods will still work...hmm... wait... then they won't work in 4d... ok nevermind! I just realized while writing this that backwards compatibility won't work! oh well, at least I can show it to my friends haha

Link to comment
Share on other sites

@OP

So how many changes do you need?

 

I would have to make a lot of changes... I'm considering just ditching Forge and doing this on my own if there isn't a way to do it with Forge hooks.

 

I am pretty sure the extent of the changes you would need to make would make it impossible to remain compatible with Forge: You would have to add additional parameters to a number of packets, and in doing that, everything will break.

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

The amount of changes he wants to make would make it impossible to stay compatible with anything. 4th dimensional physics is hard/almost impossible to deal with in 3d space.

ESPECIALLY a game which is deigned FUNDAMENTALLY for 3d work.

To answer the question no Forge does not support editing base classes, and as this is a fundamental shift in how everything works we can not support your efforts.

You're better off writing your own engine at this point and good luck trying to get 4D physics to work.

 

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team on Patreon

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

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