31 lines
1.6 KiB
Java
31 lines
1.6 KiB
Java
import com.google.gson.JsonParser;
|
|
import com.mojang.serialization.JsonOps;
|
|
import net.minecraft.client.renderer.item.ClientItem;
|
|
import net.minecraft.client.renderer.item.ItemModels;
|
|
import net.minecraft.client.color.item.ItemTintSources;
|
|
import net.minecraft.client.resources.model.cuboid.CuboidModel;
|
|
import java.nio.file.*;
|
|
import java.util.zip.ZipFile;
|
|
import java.io.InputStreamReader;
|
|
import java.nio.charset.StandardCharsets;
|
|
|
|
// Run with the Minecraft 26.2 client and its libraries on the classpath.
|
|
class CheckSoupModels {
|
|
public static void main(String[] args) throws Exception {
|
|
ItemModels.bootstrap();
|
|
ItemTintSources.bootstrap();
|
|
try (var zip = new ZipFile(args[0])) {
|
|
for (String name : new String[]{"assets/astradev_soups/items/combined_soup.json", "assets/astraplus/items/colored_water.json",
|
|
"assets/astradev_soups/models/item/soup_liquid.json", "assets/astraplus/models/internal/colored_water.json"}) {
|
|
var entry = zip.getEntry(name);
|
|
if (entry == null) throw new AssertionError("Missing packed model " + name);
|
|
try (var reader = new InputStreamReader(zip.getInputStream(entry), StandardCharsets.UTF_8)) {
|
|
if (name.contains("/items/")) ClientItem.CODEC.parse(JsonOps.INSTANCE, JsonParser.parseReader(reader)).getOrThrow();
|
|
else if (CuboidModel.fromStream(reader).geometry() == null) throw new AssertionError("Missing geometry " + name);
|
|
System.out.println("PASS Minecraft 26.2 model decoder: " + name);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|