2

I made a gun and I can shoot it now, with the only problem being that the gun would not be pointed towards to front while I am holding it, which is such a scene killer. Is there a way I can configure the player model if they are holding a specific item only by using datapack commands? Otherwise BlockBench?

2 Answers 2

3

You would need to use a texture pack for that. If you only want to change that angle/position an item is held at, that would only require a model data file. If you also want a custom texture (and not overwrite the existing item texture (say bow for example), you would need to tag an item with a model data nbt tag so you can assign a custom texture in the texture pack. I can explain more if you need.

7
  • Yes thank you. I have created a custom model for my gun using blockbench but I haven't really made a player model. My question is, even if I made a seperate player model with arms stretching out by what means can I configure my character model to this new one?
    – hfanatic
    Dec 1, 2021 at 14:49
  • I dont think you can alter player models at least without a mod. What I meant is you can change item/block models with texture packs, such as how they look when held, and I believe how they are held as well. Since you already made a texture for it, now you can tag any item with any model data tag, and then assign a custom texture (the one you made) to any item with that tag. I can provide an example.
    – Aceplante
    Dec 1, 2021 at 23:07
  • Is it that the player model configuration is a part of the item? I searched blockbench but couldn't find that option
    – hfanatic
    Dec 2, 2021 at 2:41
  • I mean you can tag it with an nbt tag and then only assign a custom texture to items with that tag. So that means if you have a bow with that tag, it will look like a gun, but a regular bow without the tag will still be normal. With this you should be able to change how the item is held but again I do not believe you can change the player without a mod. And nbt tags are applied in game.
    – Aceplante
    Dec 3, 2021 at 19:14
  • I see. I found another way round --- simply change how the item is held to create the illusion of the gun being pointed to the front
    – hfanatic
    Dec 4, 2021 at 6:15
2

First make your gun model replace a crossbow instead of a carrot on a stick so that you have the aim animation when the player holds the weapon and insert this command in a repeating command block in your world:

/replaceitem entity @p[nbt={SelectedItem:{id:"minecraft:crossbow",tag:{Charged:0b,Gun:1}}}] weapon.mainhand crossbow{ChargedProjectiles:[{id:"minecraft:arrow{disappearBug:1}",Count:1b}],Charged:1b,Gun:1}

This replaces a non charged crossbow with the Gun:1 tag with a loaded crossbow with a bugged arrow that won't appear when shot. The crossbow will activate scoreboards and will immediately reload making it the same as a carrot on a stick

The bugged arrow won't appear, make any noise or spawn particles

Give command for the crossbow (you can get it normally but you would have to shoot an arrow once to activate the above command without this):

/give @p minecraft:crossbow{ChargedProjectiles:[{id:"minecraft:arrow{disappearBug:1}",Count:1b}],Charged:1b,Gun:1}

This was tested in minecraft 1.16 but should work anywhere there is a crossbow

Also, you texture a crossbow a different way than you do a normal item so google that when you do change the models to crossbows (along with other things you are going to have to get 2 models one for the charged crossbow and a near copy for the normal crossbow, but you can make the normal crossbow one to simulate the recoil which makes it even better)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .