Jump to content

Recommended Posts

Posted (edited)

Hey.

 

I'm having a bit of a problem involving field inheritance for EntityPlayer. My mod thread is over in the Mods subforum, and I've had to revoke the download for it for the time being due to an error. My focus is the /eyepos command implemented by my mod.

 

On my serverside I have a packet that gets sent out to the client who ran the command that tells them to update their defaultEyeHeight field. This is my custom field that I implemented via ASM. However, I have found that the code will error when attempting to be indexed on EntityPlayerSP. Naturally, this is the one thing that's absolutely required for it to work. How do I go about ensuring that all of the classes under EntityPlayer inherit the field? I think the most annoying part of this issue is that casting the player to EntityPlayer did not work as needed, as the error still said that it wasn't a valid member of despite the cast. This was also the case if I had my reflection method index the superclass until it hit EntityPlayer to grab the field. I have also attempted to append the field to the EntityPlayerSP class (Rather than just the plain EntityPlayer) via asm but even that fails for some unknown reason.

 

Right now, this is the only issue holding the mod from release. Any ideas?

Edited by Xan the Dragon

Check out my website!

Posted (edited)

Error Log?

 

Well, if you are passing a packet from client to server but it is on a singleplayer world, there's a server, but not a dedicated server. I'm not sure, but maybe that could be the problem. Try a manual check for a server and if it isn't a server, just do it all clientside.

 

The problem could be that EntityPlayerSP extends an abstract class, AbstractClientPlayer, which extends EntityPlayer.

EntityPlayerSP isn't referenced in these kinds of situations. You run most things on EntityPlayer.

In what situation must this be applied to EntityPlayerSP?

If you're using Minecraft.getMinecraft().player, you shouldn't. Use the reference from the command as your player.

 

I know nothing about ASM. This is literally all speculation.

Edited by hiotewdew
Posted
3 hours ago, diesieben07 said:

Don't add fields to things via ASM. Use capabilities to store additional data on an entity.

Alright, thanks. This will actually make it quite a lot easier to manage, since I don't have to use reflection to get my value anymore. I'll edit this reply when I am able to test that, since I'm away from home right now.

Check out my website!

Posted (edited)

Edit: I managed to find out why it wasn't working at all on the coremod end of it. I had not known (primarily for lack of any documentation what-so-ever that I could find on the resources offered by Forge) that I had to edit my MANIFEST.MF file to show the code to my CoreMod. I managed to find that information on some obscure post from the Minecraft forums instead of the one place I was expecting to find it: The forge API. If I had to put it simply? I'm furious. I spent quite some magnitude of my own time searching for potential asm mistakes, replication errors, even re-reading the one page on the entire website that says how to set up the parts of your mod. I looked up pages and pages of things on Google to find out if I was doing any asm wrong, maybe to see if other people had my issues. I did all of this only to find out that I had to edit my manifest file, more that my code was absolutely functional. I really don't have much else than that. I've gotten my point across. At least I learned a lot when trying to find the mistake that I thought was in my code.

 

If I had to get back on topic? It's working fine now that I have been able to actually test it. I guess the least I can do is say thanks, because you pointed me to using a bit of a better method for storing player data. Thanks.

Edited by Xan the Dragon

Check out my website!

Posted
5 hours ago, diesieben07 said:

There is no documentation on coremods because you should not be making them.

Then I assume there's some workflow Forge offers so that we can request event additions? I do understand why making coremods may be "frowned upon" per se, because the reason Forge was created was to prevent the very thing that CoreMods do - Class replacement. I think asking Forge to append event hooks to everything is rather overkill, but I would be willing to come up with a solution, in fact as I was writing this reply I did come up with something.

 

Well, I shouldn't really be as mad as I was. The reason behind preventing coremods is logical and I see good reason for not promoting them.

 

Thanks for the help otherwise, again. Wasn't a huge breakthrough but it was certainly of value.

Check out my website!

Posted
5 hours ago, Xan the Dragon said:

Then I assume there's some workflow Forge offers so that we can request event additions?

It's called "make a pull request on the Minecraft Forge github.

5 hours ago, Xan the Dragon said:

I do understand why making coremods may be "frowned upon" per se, because the reason Forge was created was to prevent the very thing that CoreMods do - Class replacement.

Coremods are also very easy to do Wrong and cause the mod to be incompatible with other mods. It's not a class replacement issue, but the fact that it is VERY easy for a coremod to do naughty things that make it break when other mods are present, because those mods expect vanilla/Forge behavior and the coremod altered things.

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.

Posted
7 hours ago, diesieben07 said:

Not necessarily that. It is the fact that when they break, it is usually not apparent who is at fault, since a coremod by design modifies code that is not it's own (and thus not able to be traced back to it). If those modifications now crash, it looks like whoever wrote that code initially (usually Mojang) is at fault.

Good point.

Related, such crashes are why I stopped supporting Reika's mods. He used reflection in his API to handle taking the machine recipe and putting it into his data structures.

And he didn't do it correctly (wasn't reflecting the right fields).  Took almost a month of back and forth with him in PMs to get it working.

 

Then he updated from v9 to v10 of his API and removed/moved/renamed methods entirely, causing my code to crash (listing my mod at fault).

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.

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.