#Creating a radio but I lack the knowledge to have custom animations when using the item

10 messages · Page 1 of 1 (latest)

faint plank
#

Made a custom model item out of a warped-fungus-on-a-stick. It has custom texture animations but lacks proper animation when getting used. (In this context I wish to have the side button pushed in when right-clicked). How should I go about it?

raw topaz
#

no way to do that with a resource pack alone
You'd need a datapack that swaps out the item (or changes the CustomModelData nbt of the item via an item modifier) when you detect the fungus on a stick being used.

faint plank
#

oh! I already have a datapack that's detecting the r-click so thats convinient to hear that. I'll give it a shot

faint plank
#

Okay update : I have no idea how to pull that off. Can i perhaps ask how you'd swap out items? @raw topaz

raw topaz
# faint plank Okay update : I have no idea how to pull that off. Can i perhaps ask how you'd s...

(anything I write in caps now has to be replaced with whatever you named your folders/files)

Make 2 .json files inside your data pack (YOURPACK/data/NAMESPACE/item_modifiers/) and name them something you remember.
Put this text in them (with different values):

{
  "function": "minecraft:set_nbt",
  "tag": "{CustomModelData:1}"
}

And in your rightclick detection function you add /item modify commands to swap to the respective CustomModelData value you need
(command would be item modify @s weapon.mainhand NAMESPACE:ITEM_MODIFER_NAME)

You'll probably have to check in some way whether the item was in your main or off hand and which one you currently held, but you could do that with advancements I guess (or however you detect the rightclick atm).

faint plank
#

Okay! I'll give this a shot!

faint plank
#

Ok I managed to pull off the swapping that you've instructed

#

it went as intended to swap, BUT, the main issue now becomes that whenever it swaps it gets pulled down (similar to when swapping between items; via down and back up motion while equipped by the player). By any chance do you perhaps know how to avoid that? @raw topaz

raw topaz
#

The only workaround I know is to give the item really slow attack speed so that it gets stuck at the bottom of that "swapping" animation (and never moves up) and adjust the display settings so that it is displayed higher.

faint plank
#

dang -- thank you so much for the help so far btw