Fix datagen test for sounds definitions provider (#8249)

This commit is contained in:
sciwhiz12 authored and GitHub committed 2021-12-13 11:32:53 -08:00
1 parent 1fd8b1a4b8
commit d1a55a147e
7 files changed
+179 -21

No files matched your search

@@ -53,6 +53,7 @@ import net.minecraftforge.common.data.SoundDefinitionsProvider;
import org.apache.commons.lang3.tuple.Triple;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.jetbrains.annotations.Nullable;
import org.jline.utils.InputStreamReader;
import com.google.common.collect.HashMultimap;
@@ -297,14 +298,14 @@ public class DataGeneratorTest
//item.trident.return
this.add(SoundEvents.TRIDENT_RETURN, definition().with(
sound("item/trident/return1").volume(0.8),
sound("item/trident/return2").pitch(1.2).volume(0.8),
sound("item/trident/return3").pitch(0.8).volume(0.8),
sound("item/trident/return2").volume(0.8),
sound("item/trident/return2").pitch(1.2).volume(0.8),
sound("item/trident/return2").pitch(0.8).volume(0.8),
sound("item/trident/return2").pitch(1.2).volume(0.8),
sound("item/trident/return2").pitch(1.2).volume(0.8),
sound("item/trident/return3").volume(0.8),
sound("item/trident/return3").pitch(1.2).volume(0.8),
sound("item/trident/return3").pitch(0.8).volume(0.8)
sound("item/trident/return3").pitch(0.8).volume(0.8),
sound("item/trident/return3").pitch(0.8).volume(0.8),
sound("item/trident/return3").pitch(1.2).volume(0.8)
).subtitle("subtitles.item.trident.return"));
//music_disc.blocks
@@ -362,12 +363,16 @@ public class DataGeneratorTest
private List<String> compareAndGatherErrors(final Triple<String, JsonElement, JsonElement> triple)
{
return this.compare(triple.getRight(), triple.getMiddle()).stream().map(it -> triple.getLeft() + ": " + it).collect(Collectors.toList());
return this.compare(triple.getMiddle(), triple.getRight()).stream().map(it -> triple.getLeft() + ": " + it).collect(Collectors.toList());
}
private List<String> compare(final JsonElement vanilla, final JsonElement generated)
private List<String> compare(final JsonElement vanilla, @Nullable final JsonElement generated)
{
if (vanilla.isJsonPrimitive())
if (generated == null)
{
return Collections.singletonList("vanilla element has no generated counterpart");
}
else if (vanilla.isJsonPrimitive())
{
return this.comparePrimitives(vanilla.getAsJsonPrimitive(), generated);
}