Trinkets (Fabric)

Trinkets (Fabric)

22M Downloads

Trouble rendering backpack on the back of player

mainrs opened this issue ยท 7 comments

commented

I added a backpack item using your mod and wanted to add a FeatureRenderer to the game that renders the model if the player has one equipped. I saw that you included transformation matrices for the chest but couldn't find one that is for the back of the player.

commented

I managed to get it to work by overwriting the render method. I am not sure if it is an issue on my code or not but the item only renders if I have anything in my hand. If my hand it empty, the item does not get rendered onto the player's model.

I added a simple stdout call and the render method does get called but there is no render at all unless one of my player hands is not empty.

commented

if you have a repo I could look at I could help you out more. If you haven't already seen it, this repository has a wiki with a tutorial on how to get trinkets rendering.

commented

Here is the render code. I am a huge OpenGL noob and this is my first code I've ever written using it, so bare with me.

I don't render an item texture, I do render a block model instead. The transforms and rotations are needed because I think that my model isn't centered/pivoted correctly. Since you got the code you can launch it and see yourself.

Thanks for helping me out!

commented

You are intended to offset to the chest then offset to wherever you want to render off of the torso segment, such as on the back, just use minecraft's transform method.

commented

That link you sent me is a 404.

commented

Sorry, it was set to private. I changed it.

commented

You don't need to copy the code from the method, since you're inheriting ITrinket you can just call translateToChest. I'm not actually sure what the parameters for BlockModelRenderer.render are but the code looks otherwise correct.