[Tutorial] Creating texture variation for entities (custom code) [1.17.1]

Started by Doo89 on

Topic category: User side tutorials

Last seen on 17:25, 30. Apr 2024
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
[Tutorial] Creating texture variation for entities (custom code) [1.17.1]
Wed, 02/16/2022 - 07:19 (edited)

For versions 1.16.5 / 1.15.2 see this post: https://mcreator.net/forum/79178/tutorial-creating-texture-variations-entities-custom-code-11651152

  • First, realize your elements: Entity

1

In my example the textures are named: chat1.png, chat2.png, chat3.png and chat4.png

10

 

  • Clic on Edit code : 2
  • Select the file that ends with: Entity.java (1 blue in my exemple)

3

  • At the beginning of the class add this:
public int texture;

5

  • Look for code that looks like this:

4

  • Under the red line add:
texture =(int) Math.round((Math.random()) * 2);

That's it for this file, it should look like this:

6

Since I have 4 textures, the 2 should be replaced by a 3.

  • Close and save, and lock the code

 

  • Edit the code of your entity file, which ends with Renderer.java (2 red)7
  • Insert this line below the start of class, and modify between the parentheses
public final ResourceLocation texture = new ResourceLocation("VOTREMOD", "textures/TEXTURE.png");
  • Modify the line where there is the texture (in blue)

8

 

Sorry for my English.

French video : https://www.youtube.com/watch?v=HTeQoFClJaQ

Edited by Doo89 on Wed, 02/16/2022 - 07:19
You don't save it inside the…
Wed, 02/16/2022 - 21:30

You don't save it inside the entity, so other players will see another texture.

Last seen on 17:25, 30. Apr 2024
Joined Aug 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Damn, thanks for the info. I…
Thu, 02/17/2022 - 07:51

Damn, thanks for the info.
I'm only testing on my PC solo, I didn't even think other players could see another texture.
But if I see a red cat and another player sees it green, does it matter?

Last seen on 13:30, 28. Apr 2024
Joined May 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
how do I do this with…
Fri, 02/17/2023 - 17:46

how do I do this with geckolib mobs