Jump to content

Recommended Posts

Posted (edited)

2020-06-15_20_13_43.thumb.png.04fdea5e8e35bda32876f2b8ccedbc25.png

 

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 by CrackedScreen
Posted

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.

Posted
{
    "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.

Posted

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?

Posted

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.

Posted (edited)

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 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.

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.