Fix BlockStateProvider item models not knowing about block models

Add tests for this case
This commit is contained in:
tterrag committed 2020-12-10 21:37:13 -05:00
1 parent b7fb6484d7
commit a57a240c13
5 files changed
+19 -3

No files matched your search

@@ -41,6 +41,7 @@ import com.google.common.collect.HashMultimap;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Multimap;
import com.google.common.collect.ObjectArrays;
import com.google.common.collect.Sets;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonArray;
@@ -438,7 +439,7 @@ public class DataGeneratorTest
ModelFile barrel = models().cubeBottomTop("barrel", mcLoc("block/barrel_side"), mcLoc("block/barrel_bottom"), mcLoc("block/barrel_top"));
ModelFile barrelOpen = models().cubeBottomTop("barrel_open", mcLoc("block/barrel_side"), mcLoc("block/barrel_bottom"), mcLoc("block/barrel_top_open"));
directionalBlock(Blocks.BARREL, state -> state.get(BarrelBlock.PROPERTY_OPEN) ? barrelOpen : barrel); // Testing custom state interpreter
logBlock((RotatedPillarBlock) Blocks.ACACIA_LOG);
stairsBlock((StairsBlock) Blocks.ACACIA_STAIRS, "acacia", mcLoc("block/acacia_planks"));
@@ -457,6 +458,9 @@ public class DataGeneratorTest
simpleBlock(Blocks.TORCH, models().torch("torch", mcLoc("block/torch")));
horizontalBlock(Blocks.WALL_TORCH, models().torchWall("wall_torch", mcLoc("block/torch")), 90);
models().cubeAll("test_block", mcLoc("block/stone"));
itemModels().withExistingParent("test_block", modLoc("block/test_block"));
}
// Testing the outputs
@@ -465,6 +469,7 @@ public class DataGeneratorTest
// 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 static final Set<ResourceLocation> CUSTOM_MODELS = ImmutableSet.of(new ResourceLocation(MODID, "block/test_block"));
private List<String> errors = new ArrayList<>();
@@ -472,7 +477,7 @@ public class DataGeneratorTest
public void act(DirectoryCache cache) throws IOException
{
super.act(cache);
this.errors.addAll(testModelResults(models().generatedModels, models().existingFileHelper, IGNORED_MODELS));
this.errors.addAll(testModelResults(models().generatedModels, models().existingFileHelper, Sets.union(IGNORED_MODELS, CUSTOM_MODELS)));
this.registeredBlocks.forEach((block, state) -> {
if (IGNORED_BLOCKS.contains(block)) return;
JsonObject generated = state.toJson();