Jump to content

Mod works with 1.7.10, but not 1.7.2


Naruto1310

Recommended Posts

A user of my mod recently reported a strange crash. It goes against anything I thought I know about Java and I have no idea how this can happen.

 

The 1.7.2 version of my mod uses a coremod with a MCVersion annotation, so it only works with 1.7.2. For the 1.7.10 version I removed that annotation, so it should work 1.7.2 and 1.7.10.

The user is now using that 1.7.10 version for MC 1.7.2, but this causes the following crash: http://pastebin.com/HsRXtQ0w

Here the interesting part:

[10:43:52] [Client thread/ERROR] [FML/]: Caught exception from CraftableAnimals
java.lang.NoSuchFieldError: field_150354_m
at naruto1310.craftableAnimals.vanilla.mod_CraftableAnimals.initRecipes(mod_CraftableAnimals.java:387) ~[mod_CraftableAnimals.class:?]

The line mentioned here uses the field Blocks.sand which gets obfuscated to Blocks.field_150354_m.

 

The strange thing about it is, that this line is identical for the 1.7.2 and 1.7.10 versions of my mod. The 1.7.2 version works for MC 1.7.2, but the 1.7.10 version does not.

I don't see any reason why the game should crash at this point.

Link to my mod: http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/1278508-craftable-animals-v2-4-2-2-mocreature-extension-v1

Link to comment
Share on other sites

Why are you a coremod you're screwing things up with it.

Beyond that the type for the Sand field changed in .10, we fix this for normal mods with a transformer, you need to recompile your mod if it doesnt run through our transformers {which would be caused by your coremod}

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 looked the both versions using a decompiler and the lines where the same. I just realized that the bytecode actually demands the field to have a specific type, so that explains that.

 

How do I prevent this from happening? I need to have an ASM transformer to insert some of my code into base classes. How can I then run your transformers?

 

Link to comment
Share on other sites

One example would be, that I allow most mobs to wear armor. The code for applying armor and calculating its effects is already there for all mobs, so I just have to make it render correctly. So at the end of each render method I insert a call to my own method, that renders the armor.

 

Another example would be that I allow the spawner to be deactivated using redstone. So at the beginning of its update method I check if the block is getting powered and cancel the rest of the method if necessary.

Link to comment
Share on other sites

Neither of those tasks need a coremod, you can replace the rendering model for the entity in an event.

And you can replace the spawner tile entity with your own.

Coremods should be a LAST resort.

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

Coremods were created to stop people from editing base classes directly, as a compromise because modders would not stop.

Thats it, full stop.

Coremods are bad and should always be avoided.

Anything a coremod does should be scrutinized and evaluated on if it is necessary.

The proper way for situations like this is for one mod in your mod pack to lay claim to 'I am replacing vanilla block X, I am 100% in control of it.'

If you have two mods who do that let the player decide which takes precedence.

Same concept goes for editing any other mod item, you should always go the route of arbitration and communication with the original author {In vanilla's case PRs to Forge} opposed to injecting your own things.

 

A note: In the future I plan on making it A LOT more of a pain in the ass for the end user/modder to create/use coremods. I'm trying to wipe out all these 1/2 thought through coremods that can be done in cleaner ways.

 

Also combine this with the fact that if you think you are important enough to change vanilla code, you should take the time to research how coremods actually work and what order they are applied in. And how java bytecode works, the fact that you even asked this question shows that you have not.

I hold coremodders to a higher standard, because they should know better. No help is given when making coremods.

 

 

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

If there is a event for rendering entities it is probably cleaner to do it that way, although it won't give me the control I have now and I'll have to copy + paste some vanilla code.

Maybe I just haven't found it, but I don't know a clean way to replace vanilla block completely. Using reflection you could replace the reference in the Blocks class, but at that point it's already been registered all over the place.

 

Anyway, I can understand that you say coremods are for advanced modders only and they have to figure things out themselves. I'll look into that. But actively making coremods painful, just for the sake of them being painful seems kind of pointless to me. Why have them, if you don't want anybody to use them?

Maybe it's my fault that I use them. Maybe I could do these things without them, but some things really cannot be done without them and I think they are a great way to give lots of power to modders, without having them edit base classes directly.

You already made access transformers available to non-coremods. Maybe you could to the same thing with ASM transformers.

 

And yes, I think I am important enough to insert a tiny call into a base class. I'm not sure if I'm important enough to replace a vanilla block entirely.

Link to comment
Share on other sites

You already made access transformers available to non-coremods. Maybe you could to the same thing with ASM transformers.

This was specifically done BECAUSE we are tightening the coremods down and we DO NOT want people making coremods.

Yes you can fuck things up with a AT but a hell of a lot less then with real transformers.

And from our research most coremods were just for access transformers. Hence we gave the modders what they want in a restricted manor and will be locking down the other side to make modders behave.

 

Anyways this is going in circles, let me just lay down the final answer:

Coremods ARE NOT supported

Coremods SHOULD NEVER be made aside from when there is LITERALLY no other option

Anyone who makes Coremods will get NO official support from us as they should already know {or be able to do there own research} on how to do things.

The plan is to make coremods harder to make/use for both the end users protection, and to discourage there usage which has become to prolific.

Note: By 'harder' I mean standard java functionality and practices that any library should have to go through but we don't in MC modding because it's a hacky system. Anyone who DOES make a coremod should have no issue adapting and those who can't should never be making base edits in the first place.

 

Anyways your original question is simple, you should be able to address it yourself. I would also advise you stop using a coremod as you have no real need to.

Locking thread.

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.


×
×
  • Create New...

Important Information

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