zlainsama / CosmeticArmorReworked

This mod allows you to wear two sets of armor, one for display, one for function.
https://minecraft.curseforge.com/projects/cosmetic-armor-reworked
Other
17 stars 18 forks source link

Issue with Real First Person Render and First Person Render mods #29

Closed captain-qua closed 5 years ago

captain-qua commented 5 years ago

When using this mod alongside Real First-Person Render or the similar mod First Person Render (they look to be essentially the same, both in general and how they display this issue), helmets in the Cosmetic Helmet slot are displayed on the player dummy used to create the body, and they rotate with the player's view. This can obscure a lot of the screen. Oddly enough, while helmets are rotated with the player's view, it seems like Pumpkins and Skulls on the player dummy don't rotate at all, which keeps them out of the way.

Everything still looks normal when in Third Person mode as well.

Some screenshots are attached showing the effect when wearing a helmet and looking forwards (no issue), when wearing a helmet and looking down (somewhat obscured), when wearing a helmet and looking up (no issue), and when wearing a helmet and looking at a 45 degree angle towards the ground (almost totally obscured). I've also attached a screenshot while wearing a skull and looking at a 45 degree angle towards the ground (no issue) and a screenshot while wearing the skull and looking straight down (the "chin" of the skull is visible, proving that it is rendering, just not rotated to follow the head).

Looking up with helmet (no issue): a-helmetup

Looking forwards with helmet (no issue): b-helmetforwards

Looking down with helmet (somewhat obscured): c-helmetdown

Looking at a 45 degree downwards angle with helmet (almost completely obscured): e-helmetangleddown

Looking at a 45 degree angle with a Skeleton Skull (no issue): f-skullangleddown

Proving that the Skeleton Skull is rendering, but doesn't rotate, and so can't get in the way: g-skullbottomvisible If all headwear

You can disregard this last paragraph if I'm totally wrong, since I've never actually written a Minecraft mod, but just by looking through Real First-Person Render's Source, I believe the problem might be that the cosmetic headware ignores the playerModel.bipedHead.isHidden and the playerModel.bipedHeadwear.isHidden things, at Line 165 (and 166)?

I'd love if these could be fixed, so I could enjoy pretty armor, good defense, and an immersive first-person experience all at once. Thanks for your time!

zlainsama commented 5 years ago

Unfortunately, CosmeticArmorReworked achieves its goal by replacing armor pieces before a player render occur and restore them back right after the render (even if the render event is canceled), thus the cause described in your last paragraph isn't the case. I'll look into this.

zlainsama commented 5 years ago

After looking through Real First-Person Render's source code you provided and related vanilla code (not thoroughly), the head, headwear and helmet layer do not get rotated in a first person render, and helmet layer is not easily accessible, thus RFPP is properly hiding head and headwear but, helmet layer is hidden through removing helmet item temporarily, which will get replaced by CosmeticArmorReworked before the render, causing the issue. A possible fix for RFPP to implement would be using 1 (forge's access transformers) or 2 (java's reflection api) to gain access of layers and properly hide helmet layer instead of removing helmet item temporarily during the render. (there must be other ways of achieving the same goal, but these two is what i can think of at this moment)

zlainsama commented 5 years ago

There is not much i can do on my side. The api provided in the latest version of CosmeticArmorReworked might also be used to workaround this issue by removing the helmet item in cos slots temporarily, but it could cause problems and it also needs to be done on RFPP side.

captain-qua commented 5 years ago

Okay, thanks for looking into this at least!