The bug
The following is based on decompiled version of Minecraft 1.10.2 using MCP. All method and class names are the names used in the decompiled version.
The public void deleteTexture(ResourceLocation textureLocation) method of the net.minecraft.client.renderer.texture.TextureManager class is not removing the entry for the provided ResourceLocation in the mapTextureObjects map.
public void deleteTexture(ResourceLocation textureLocation)
{
ITextureObject itextureobject = this.getTexture(textureLocation);
if (itextureobject != null)
{
// suggested fix: add this line
this.mapTextureObjects.remove(textureLocation);
TextureUtil.deleteTexture(itextureobject.getGlTextureId());
}
}This is very likely still the case in 1.11 snapshot 16w42a:
Class:
byuMethod:
public void c(kq ?)
public void c(kq ?)
{
byv ? = b(?);
if (? != null) {
byw.a(?.b());
}
}Comments 3
This seems to have indeed been fixed in 1.20 pre-3.
1.20 pre-3:
public void c(acq $$0) {
ftx $$1 = this.c.remove($$0);
if ($$1 != null) {
this.c($$0, $$1);
}
}This now calls this.c.remove($$0) instead of getOrDefault, so the map entry is actually removed. It then delegates to the private cleanup helper:
private void c(acq $$0, ftx $$1) {
if ($$1 != fuc.c()) {
this.d.remove($$1);
try {
$$1.close();
}
catch (Exception $$2) {
b.warn("Failed to close texture {}", (Object)$$0, (Object)$$2);
}
}
$$1.b();
}This does everything the old code was missing: removes from the tickable set (this.d), calls close() on the texture, and releases the GL texture ID via $$1.b().
For context, this.c is the texture map and this.d is the tickable texture set, both declared identically in both versions:
private final Map<acq, ftv> c = Maps.newHashMap();
private final Set<fum> d = Sets.newHashSet();Prior Versions:
public void c(acq $$0) {
ftv $$1 = this.b($$0, (ftv)fua.c());
if ($$1 != fua.c()) {
TextureUtil.releaseTextureId((int)$$1.a());
}
}This calls b(acq, ftv), which is just a getOrDefault wrapper:
public ftv b(acq $$0, ftv $$1) {
return this.c.getOrDefault($$0, $$1);
}So it looks up the texture from the map, releases the GL texture ID if found, but never removes the entry from the map. It also never calls close() on the texture object, and doesn't touch the tickable texture set. This matches the bug as originally reported.
Does this still affect the latest versions of the game (Stable 1.15.2 / Snapshot 20w21a)? If so, please update this ticket accordingly - Unfortunately, I am unable to do so myself.
Quick Links:
📓 Issue Guidelines – 💬 Community Support – 📧 Customer Support – ✍️ Feedback and Suggestions – 📖 Game Wiki