mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-17 02:55:17 +00:00
Fix inconsistencies with model/blockstate datagen
This commit is contained in:
1 parent
96b9a057b7
commit
a3edfd3748
54 files changed
+247
-146
No files matched your search
@@ -272,7 +272,9 @@ public class DataGeneratorTest
|
||||
.texture("layer0", mcLoc("item/fishing_rod_cast"));
|
||||
}
|
||||
|
||||
private static final Set<String> IGNORED_MODELS = ImmutableSet.of("test_generated_model", "test_block_model");
|
||||
private static final Set<String> IGNORED_MODELS = ImmutableSet.of("test_generated_model", "test_block_model",
|
||||
"fishing_rod", "fishing_rod_cast" // Vanilla doesn't generate these yet, so they don't match due to having the minecraft domain
|
||||
);
|
||||
|
||||
@Override
|
||||
public void act(DirectoryCache cache) throws IOException
|
||||
@@ -436,7 +438,9 @@ public class DataGeneratorTest
|
||||
// Testing the outputs
|
||||
|
||||
private static final Set<Block> IGNORED_BLOCKS = ImmutableSet.of(Blocks.BIRCH_FENCE_GATE, Blocks.STONE);
|
||||
private static final Set<ResourceLocation> IGNORED_MODELS = ImmutableSet.of();
|
||||
// Vanilla doesn't generate these models yet, so they have minor discrepancies that are hard to test
|
||||
// This list should probably be cleared and investigated after each major version update
|
||||
private static final Set<ResourceLocation> IGNORED_MODELS = ImmutableSet.of(new ResourceLocation(MODID, "block/cube"));
|
||||
|
||||
private List<String> errors = new ArrayList<>();
|
||||
|
||||
@@ -648,6 +652,24 @@ public class DataGeneratorTest
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
JsonElement generatedTextures = generated.remove("textures");
|
||||
JsonElement vanillaTextures = existing.remove("textures");
|
||||
if (generatedTextures == null && vanillaTextures != null) {
|
||||
ret.add("Model " + loc + " is missing textures");
|
||||
} else if (generatedTextures != null && vanillaTextures == null) {
|
||||
ret.add("Model " + loc + " has textures when vanilla equivalent does not");
|
||||
} else if (generatedTextures != null) { // Both must be non-null
|
||||
for (Map.Entry<String, JsonElement> e : generatedTextures.getAsJsonObject().entrySet()) {
|
||||
String vanillaTexture = vanillaTextures.getAsJsonObject().get(e.getKey()).getAsString();
|
||||
if (!e.getValue().getAsString().equals(vanillaTexture)) {
|
||||
ret.add("Texture for variable '" + e.getKey() + "' for model " + loc + " does not match vanilla equivalent");
|
||||
}
|
||||
}
|
||||
if (generatedTextures.getAsJsonObject().size() != vanillaTextures.getAsJsonObject().size()) {
|
||||
ret.add("Model " + loc + " is missing textures from vanilla equivalent");
|
||||
}
|
||||
}
|
||||
|
||||
if (!existing.equals(generated)) {
|
||||
ret.add("Model " + loc + " does not match vanilla equivalent");
|
||||
@@ -662,6 +684,6 @@ public class DataGeneratorTest
|
||||
private static String toVanillaModel(String model) {
|
||||
// We generate our own model jsons to test model building, but otherwise our blockstates should be identical
|
||||
// So remove modid to match
|
||||
return model.replaceAll("^\\w+:", "");
|
||||
return model.replaceAll("^\\w+:", "minecraft:");
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user