Files
AstraCauldron/tools/CheckSoupModels.java
T

26 lines
1.3 KiB
Java
Raw Normal View History

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.*;
// 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();
Path assets = Path.of(args[0]);
try (var reader = Files.newBufferedReader(assets.resolve("items/combined_soup.json"))) {
ClientItem item = ClientItem.CODEC.parse(JsonOps.INSTANCE, JsonParser.parseReader(reader)).getOrThrow();
System.out.println("PASS: Minecraft 26.2 decodes composite bowl and custom model color tint: " + item.model());
}
try (var reader = Files.newBufferedReader(assets.resolve("models/item/soup_liquid.json"))) {
CuboidModel model = CuboidModel.fromStream(reader);
if (model.geometry() == null || model.transforms() == null) throw new AssertionError("Missing geometry/transforms");
System.out.println("PASS: Minecraft 26.2 decodes liquid geometry and item display transforms");
}
}
}