Migrate AstraSoups to NeoForge as AstraCauldron
This commit is contained in:
@@ -5,21 +5,26 @@ 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();
|
||||
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");
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user