mirror of
https://github.com/BlueMap-Minecraft/BlueMap.git
synced 2025-02-23 16:01:32 +01:00
Fix (rarely) possible null-values in textures.json
This commit is contained in:
parent
c3dd98ce2d
commit
0e84d4f914
@ -9,6 +9,7 @@
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
import java.io.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@ -41,10 +42,11 @@ public synchronized void put(ResourcePack resourcePack) {
|
||||
|
||||
public void writeTexturesFile(ResourcePack resourcePack, OutputStream out) throws IOException {
|
||||
Texture[] textures = new Texture[nextId];
|
||||
Arrays.fill(textures, Texture.MISSING);
|
||||
|
||||
ordinalMap.forEach((textureResourcePath, ordinal) -> {
|
||||
Texture texture = textureResourcePath.getResource(resourcePack::getTexture);
|
||||
if (texture == null) texture = Texture.MISSING;
|
||||
textures[ordinal] = texture;
|
||||
if (texture != null) textures[ordinal] = texture;
|
||||
});
|
||||
|
||||
try (Writer writer = new OutputStreamWriter(out)) {
|
||||
|
Loading…
Reference in New Issue
Block a user