Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

[1.16.4] Replace vanilla block texture


Recommended Posts

Hello, so I wanted to make a mod that changes the blocks texture under certain conditions like for example if the scoreboard has a certain string all wool textures will be replaced with my custom texture. How would I set the texture for a block and show it when they enter a world with the scoreboard condition?

Link to post
Share on other sites

Traditional means of changing the texture would mean you would have to re-render all chunks with wool in them, which of course is not acceptable. Thankfully we can use the same technique that Minecraft uses for texture animations.

  • Subscribe to TextureStitchEvent.Pre, this is where you need to tell the game about your custom texture (call addSprite).
  • To change the wool texture, you need to then "draw over" the wool image in the atlas texture. To do this, you need to do the same as TextureAtlasSprite#uploadMipmaps / uploadFrames - but with the U/V coordinates of the wool texture.
  • There is not really a way to detect scoreboard changes, so you'll just have to check every tick.
Link to post
Share on other sites

Another question how do I draw over the blocks texture like what do I need to be able to draw over the block object? And when do I draw them I can't imagine drawing them each individually on chunk load or? any pseudocode or example class I could look at?

Edited by XenoPyax
Link to post
Share on other sites
19 minutes ago, XenoPyax said:

Another question how do I draw over the blocks texture like what do I need to be able to draw over the block object? And when do I draw them I can't imagine drawing them each individually on chunk load or? any pseudocode or example class I could look at?

1 hour ago, diesieben07 said:

To do this, you need to do the same as TextureAtlasSprite#uploadMipmaps / uploadFrames - but with the U/V coordinates of the wool texture.

Have you looked at that code?

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
×
  • Create New...

Important Information

By using this site, you agree to our Privacy Policy.