How can I make a mob change texture?

Started by XWoch on

Topic category: Help with modding (Java Edition)

Last seen on 16:22, 27. Mar 2024
Joined Apr 2015
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How can I make a mob change texture?
Tue, 10/18/2022 - 16:17 (edited)

Eyyyy! So I'm trying to recreate/redesign mobs that lost mob votes, and one of them is the Glare, in which when a mob of a certain type approaches, its eyes will change to match. However, I don't know how to do it. Do y'all know? Modding in 1.16, btw.

Edited by XWoch on Tue, 10/18/2022 - 16:17
Last seen on 00:55, 28. Mar 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Getting a mob to change…
Thu, 11/03/2022 - 02:47

Getting a mob to change texture is, (to the best of my knowledge), not possible. ...Sort of. You could try to do an animated texture, but these only seem to work if the texture file is a perfect square. (Which it usually isn't.)  However, if, (like for the glare), you need a noticeable, permeant change, there is a (slightly odd) but effective workaround:

  •  Create an new mob with the alternate texture. 
  • When the right conditions are met, (presumably for the glare, when it is too dark or too light), have a 'on entity tick' procedure that replaces the mob with the alternate texture version, making sure to have the same position, rotation, and velocity. 
  • The transition is noticeably, but barely. As an added bonus, this will allow you to add different AI to the different versions of the mob, if you need it to do different things depending on its state.