Using item states to change textures of a ranged item

Started by Gnocchi on

Topic category: Help with Minecraft modding (Java Edition)

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Using item states to change textures of a ranged item

I'm trying to create a bow item that changes textures when it charges, but nothing I do can get it to work. I'm trying to use a global variable "Bow pulled" that changes when the item is right clicked.

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
...Not sure if there's a…
Sat, 01/27/2024 - 13:18

...Not sure if there's a good way to do this beyond just two different states for drawn/fired. There should be some way to detect when the player is holding down the item, or how much use duration it has remaining, but I'm not sure if MCreator has a built in tool to reference it.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, thanks anyways
Sun, 01/28/2024 - 18:42

Ok, thanks anyways

Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
...Come to think of it, you…
Mon, 01/29/2024 - 23:24

...Come to think of it, you could try making your own variable to do this if there's no way to use the vanilla one. You would need a player-lifetime number variable, and a player-lifetime logic variable, and then some procedures to toggle them: the logic variable should become true when the player starts using the item, and false when the player finishes using the item, both of which should be detectable using global triggers. The number variable should increase by one each tick when the logic variable is true, and reset to zero when it's false. 

Then, you could determine your itemstate based on the current progress of the number variable. The tricky part is probably making sure these toggle properly when you start and stop using an item, but I'm pretty sure items have a start/finish trigger built in. Could be worth a shot.

Joined Jan 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'll give it a try
Sun, 02/04/2024 - 02:53

I'll give it a try