How to change the texture of a block in a procedure?

Started by Maquinablablabla on

Topic category: Help with MCreator software

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to change the texture of a block in a procedure?

How you can change the texture of a block in a procedure?

if for example I want to make a block that changes of color when I right click on it, how can I do it with procedures?

This is not possible yet,…
Mon, 02/25/2019 - 15:32

This is not possible yet, but there is a ticket for this to be added in the future.

Last seen on 10:52, 21. Feb 2021
Joined Jan 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Ok, thanks
Mon, 02/25/2019 - 15:34

Ok, thanks

Last seen on 17:17, 10. Jan 2024
Joined Aug 2013
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I dare to say that this is…
Mon, 02/25/2019 - 16:01

I dare to say that this is quite difficult in current versions of Minecraft. The thing is, that models of blocks (and therefore textures as well) are loaded from the .json file in the assets folder on the start of the game. The game basically bakes the data and stores it in some structure like a list or map (Minecraft most likely uses its own implementation, but it does not actually matter for this). I am pretty sure you could make your own implementation of the model and then inject it somehow, but I do not see it as an easy way. Another issue of this is that it would change the texture of every block of the type in the world.

Another way (and the way that is actually used for example when the chest textures are changed on Christmas to the present box one) is using TileEntity and TileEntitySpecialRenderer (TESR) for your block. This would allow you to manipulate each block separately. The issue is here that it makes your block much more performance heavy (especially if it is a common block), so it is not wise to use it - unless you already needed TileEntity for your block.

Therefore the most performance efficient and the easiest (unless you want a ridiculous amount of possible textures) is to make multiple blocks OR blockstates.

 

To simplify it:

If you want to control each block separately and if you need up to 16 non-dynamic possible textures, go with multiple blocks or blockstates. If you need somewhat over 16 possible textures, multiple blocks (or multiple blocks with multiple blockstates) should be enough. If you want a lot of textures or a dynamic one (like coloring one texture with every possible color), use TESR.

If you do not care about changing them all at once, you can try mess with the models in code, but I can not provide you any information about how. (You can start with taking a look at classes and interfaces in the same package as IBakedModel is) However, if you use pre-1.8 Minecraft versions, you should be able to return the texture path just from the  Block class itself, which should make it actually a lot easier.

Nuparu00, our plan for…
Mon, 02/25/2019 - 16:14

Nuparu00, our plan for MCreator is to implement this with BlockStates in the future so I think this would be the best approach for Maquinablablabla if he decides to go with programming :) Unless he has many many textures as you said.

Last seen on 00:57, 18. May 2021
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Nuparu00,  I'm currently…
Thu, 05/13/2021 - 23:18

Nuparu00, 

I'm currently trying to figure out how to make blocks kind of like the framed blocks from blockcarpentry, where the model takes on the texture of the block you're holding when you right click it. I want to be able to add any texture I want to a model I've created (for example, making a model of a chair and being able to then have that chair be made out of any material, rather than having to make 100+ different blocks for the differently textured chairs. The TESR method you mentioned here seems like it might be a good way to go about doing that, but I have no idea how to use it. Would you be able to explain how I would go about doing this - I assume it's done in procedures? Or can you link me to a good tutorial on how to do it?

Last seen on 09:42, 5. Sep 2023
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
   You cant do this but you…
Fri, 05/14/2021 - 07:56

 

 You cant do this but you could add particle effect large enough to hide the despawn and respawn of the same mob with new skin.

 

  I made a very large dust storm for example and changed the paritcle.ogg colors in my texture pack. 

 

Good Luck

Chew

 

Last seen on 09:42, 5. Sep 2023
Joined May 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
 Sorry thought you ment mob…
Fri, 05/14/2021 - 08:01

 Sorry thought you ment mob. 

 

Last seen on 17:09, 11. Mar 2024
Joined Mar 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Is it already added or not…
Sun, 08/07/2022 - 09:15

Is it already added or not yet?