diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/TextureGallery.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/TextureGallery.java index 6aa7e842..4c7cd583 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/TextureGallery.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/map/TextureGallery.java @@ -47,6 +47,10 @@ public void writeTexturesFile(ResourcePack resourcePack, OutputStream out) throw ordinalMap.forEach((textureResourcePath, ordinal) -> { Texture texture = textureResourcePath.getResource(resourcePack::getTexture); if (texture != null) textures[ordinal] = texture; + + // make sure the resource-path doesn't get lost + if (textures[ordinal].getResourcePath().equals(ResourcePack.MISSING_TEXTURE)) + textures[ordinal] = Texture.missing(textureResourcePath); }); try (Writer writer = new OutputStreamWriter(out)) { diff --git a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java index ee46db89..ea495ad1 100644 --- a/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java +++ b/BlueMapCore/src/main/java/de/bluecolored/bluemap/core/resources/resourcepack/texture/Texture.java @@ -37,6 +37,13 @@ private Texture(ResourcePath resourcePath, Color color, boolean halfTra this.texture = texture; } + private Texture(ResourcePath resourcePath) { + this.resourcePath = resourcePath; + this.color = MISSING.color; + this.halfTransparent = MISSING.halfTransparent; + this.texture = MISSING.texture; + } + public ResourcePath getResourcePath() { return resourcePath; } @@ -131,4 +138,8 @@ private static Color calculateColor(BufferedImage image){ return new Color().set(red, green, blue, alpha, false); } + public static Texture missing(ResourcePath resourcePath) { + return new Texture(resourcePath); + } + }