Posted June 16, 20205 yr For some reason, my custom weapon texture goes above the screen whenever I'm reloading. Is there any particular cause for this happening? I've even tried using the crossbow JSON values and texture like in the image above but it still does this. I don't think it's my code that is causing this kind of issue, but will post it if necessary. This issue only happens in first person view, the third person appearance is totally fine. Edited June 17, 20205 yr by CrackedScreen
June 16, 20205 yr It would be nice if you can post the json file of the weapon and include if you made any changes to the first person renderer. If you really want to you could import the model into Blockbench and look at the first person display to see if the issue is in your json file or not.
June 17, 20205 yr Author { "parent": "item/generated", "textures": { "layer0": "rifles:item/rifle" }, "display": { "thirdperson_righthand": { "rotation": [ -80, 260, -40 ], "translation": [ -1, 0, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "thirdperson_lefthand": { "rotation": [ -80, -280, 40 ], "translation": [ -1, -2, 2.5 ], "scale": [ 0.9, 0.9, 0.9 ] }, "firstperson_righthand": { "rotation": [ 0, -90, 25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] }, "firstperson_lefthand": { "rotation": [ 0, 90, -25 ], "translation": [ 1.13, 3.2, 1.13], "scale": [ 0.68, 0.68, 0.68 ] } }, "overrides": [ { "predicate": { "reloading": 1, "reloaded": 1.0 }, "model": "item/crossbow_pulling_2" }, { "predicate": { "loaded": 1 }, "model": "item/crossbow_arrow" } ] } Here's the JSON, I'm aware that the reloaded/reload finish states point to the crossbow textures but this is just debug.
June 17, 20205 yr Does your item extend CrossbowItem? That class has some special handling within the FirstPersonRenderer. That's probably my best guess as to what is going on.
June 17, 20205 yr Author It doesn't extend CrossbowItem, but has this: public UseAction getUseAction(ItemStack stack) { return UseAction.CROSSBOW; } I wasn't personally aware that crossbow had special handling by the render class, but this method might be enough to cause this issue. Is there any way I can work around this?
June 17, 20205 yr That would make sense as the method has an effect on the PlayerRenderer which in turn affects the FirstPersonRenderer. As for a way around this, you would have to update the MatrixStack when your item is held during RenderHandEvent. In that case, you could repurpose the CrossbowItem rendering by canceling the event and rendering the item yourself in the correct location.
June 17, 20205 yr Author Thanks for helping, I'll be sure to take a look in the PlayerRenderer class. It might be better for me to use something else for the time being since I have other priorities. I'll mark this as solved. Edited June 17, 20205 yr by CrackedScreen
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.