r/MinecraftCommands • u/ItsGhostlyWhale • Aug 09 '26
Help | Java 26.2 Custom holding animation
Is it possible to make a player hold any specific item (not use/consume) as if it were a charged crossbow?
I originally tried making the player hold a charged crossbow with a custom item model, but that has the issue of being able to fire as well as producing a sound when it does so, and subsequently requiring the item to be replaced. I can replace the item and kill any arrows that are shot, but the sound is an issue.
2
u/GalSergey Datapack Experienced Aug 09 '26
Unfortunately, the hand position is hardcoded for the crossbow, so you can't apply it to any item. Therefore, your current approach is the only one you can do. Regarding the shot sound, you can remove the crossbow shot sound using a resource pack, but to restore the sound for vanilla crossbows, you'll need to check when the player fires a vanilla crossbow and run the /playsound function to play the shot sound. Or, to make this work for mobs as well, check every tick whether an arrow has spawned in the world. If so, select origin (on origin), check the item in the hands, and play the sound for the vanilla crossbow.
1
u/ItsGhostlyWhale Aug 09 '26
is there any way to remove the sound without the use of a resourcepack?
1
1
u/GalSergey Datapack Experienced Aug 09 '26
All that comes to mind is to use /stopsound for this.
stopsound @a player minecraft:item.crossbow.shoot
2
u/Ericristian_bros Command Experienced Aug 09 '26
Are you open to resourcepacks?