mojira.dev
MC-12074

Textures can't be overwritten while in-game

Hello!
I'm making a texture pack, and when i modify my texture(s) using Photoshop,
i can't save over the file i'm working on (from time to time).

Sometimes i can save the image and then tab to minecraft, hold F3 and press T and the texture is updated, but most of the times i get an error prompt saying the "file is already in use". But if i wait for like 2-5 minutes i can save it again (without closing minecraft)..
This makes it very tedious for us texture makers, it worked flawlessly with the old terrain.png, though i had this same problem before when editing parts of the GUI etc.

The only way to solve this right now is to close minecraft, save image, re-open minecraft and log back in, or wait 2-5 minutes.

Linked issues

Comments 6

Well yes, that's how they work currently, and if they're not intended to work this way, it's a bug.
If you don't know for sure that this is how it's meant to be, your comment just doesn't make any sense.

I guess the files aren't properly closed in the Java code. Obviously they are closed by the Java garbage collector. This is why it works after a few minutes. So yes, this is a bug.

i Guess it would be an easy fix then. file.close()

Happened to me in 1.5.1. Just started playing around with making a texture pack, and ran into this same issue. It's not a major project of mine, so this is only a minor bug for me, but yeah.

Notably, I found that this is still an issue even when the texture pack I'm trying to modify is not the active one. This is obviously a bug, as Minecraft shouldn't be reading from any pack other than the active one, right...?

As mrheat and C.J. Wijtmans said, the cause is obvious: Minecraft is forgetting to release a lock on the texture pack zip file, and as a result retains exclusive access to the file when it's not strictly needed.
It's a very common file I/O pitfall, and the fix is trivial - just putting a texturePackZipFileObject.close() after loading the pack should suffice.

Is this still a concern in the current Minecraft version? If so, please update the affected versions in order to best aid Mojang ensuring bugs are still valid in the latest releases/pre-releases.

Texture packs are obsolete, if you have issues with resource packs, please let us know 🙂.

Robin Fernqvist

(Unassigned)

Community Consensus

Minecraft 1.5, Snapshot 13w11a, Minecraft 1.5.1, Minecraft 13w37b, Minecraft 13w41b

Retrieved