minecraft how to reload textures

GnRSlashSP

Tree Puncher

*

Members 2 26 posts

I made a GUI where the player can click a button to reload texture.

Đang xem: Minecraft how to reload textures

What I want is that the button will load a texture called testmodel.png inside .minecrat folder

 

Every time the user change the texture using Paint.NET, put the texture at this folder and click this button, the texture must be loaded and my mob need to refresh the texture to the new edited one.

 

Any ideas to guid me on this?

 

I think it doesn”t matter if the texture will be on a single png file or inside resourcepack, what I really need is to load this new edited texture every time player clicks the button, without the need of restarting minecraft. just read and refresh it on-line

 

Thanks

Quote

†GnR† Slash

can one man truly make a difference?

Link to post Share on other sites

larsgerrits 514

Posted May 18, 2016

larsgerrits

Reality Controller

*

Members 514 3462 posts
Share
Posted May 18, 2016

Minecraft already has a feature to reload the game assets. Hit F3+T in a world and it will reload all the game assets, including resource packs.

Quote

Don”t PM me with questions. They will be ignored! Make a thread on the appropriate board for support.

 

1.12 -> 1.13 primer by williewillus.

 

1.7.10 and older versions of Minecraft are no longer supported due to it”s age! Update to the latest version for support.

 

http://www.howoldisminecraft1710.today/

Link to post Share on other sites

Ernio 600

Posted May 18, 2016

Ernio

Reality Controller

*

Forge Modder 600 2638 posts
Share
Posted May 18, 2016

If you want to understand resources as whole – look into GuiResourcePacks (naming may be different).

 

In particular Minecraft.getMinecraft().refreshResources();

This allows you to “recreate” resources. They will be reloaded from Minecraft#defaultResourcePacks which to put it in simple words “contains all packs from which resources will be collected and will create all available resources”.

 

Now, in your case you will want to either:

 

1. Put your .png into your pack (your mod or texturepack) and reload resources, they will simply reload all .jar and .zip resources.

Read more: Minecraft Tutorial: How To Make A Heart In Minecraft, Minecraft Heart (Wood) : 6 Steps (With Pictures)

* Here is a big note: I am talking partially hypothetically so you might have to remove pack from Minecraft#defaultResourcePacks and re-add it for the pack itself to detect “changes” (like you putting a .png file inside). I don”t think so, but MAYBE.

 

OR

 

2. Treat your resource as custom implementation of IResourcePack which can read input stream directly from /.minecraft/directory/file.png

In that case – yeah, reloading will pretty much reload it form directory you want.

* Note: Again – like before, you might have to re-add it.

 

Other stuff:

1. I am not sure if this is still a thing in 1.9+ (was earlier), but to access Minecraft#defaultResourcePacks you will need reflection. Read up on Java tuts.

2. Synchronization WILL be a bitch here. Is this supposed to be client-only feature, or should server be able to set such .pngs (server resourcepacks) or maybe you want “admin” which will be able to change stuff for other players? That all can be done with some Java magic, but hell – lots of vanilla-code-reading and even more work with internals and this is like advanced (quite very) level of modding.

Read more: Wow How To Get Guild Rep ? Guild Guide: Reputation, Rewards, And More

 

EDIT

 

Minecraft already has a feature to reload the game assets. Hit F3+T in a world and it will reload all the game assets, including resource packs.

 

*

Leave a Comment