Fix data file not being generated in TestLootTables

This commit is contained in:
themode 2020-11-16 00:46:46 +01:00
parent 6fbea18b41
commit 11f1a5380c
2 changed files with 11 additions and 12 deletions

View File

@ -9,19 +9,9 @@ import org.jetbrains.annotations.NotNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.*;
import java.net.URL;
import java.nio.file.FileVisitResult;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.StandardCopyOption;
import java.nio.file.*;
import java.nio.file.attribute.BasicFileAttributes;
/**

View File

@ -1,5 +1,6 @@
package loottables;
import net.minestom.server.MinecraftServer;
import net.minestom.server.data.Data;
import net.minestom.server.data.DataImpl;
import net.minestom.server.gamedata.conditions.SurvivesExplosionCondition;
@ -10,12 +11,14 @@ import net.minestom.server.gamedata.loottables.entries.ItemType;
import net.minestom.server.gamedata.loottables.tabletypes.BlockType;
import net.minestom.server.item.ItemStack;
import net.minestom.server.item.Material;
import net.minestom.server.registry.ResourceGatherer;
import net.minestom.server.utils.NamespaceID;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.StringReader;
import java.util.List;
@ -25,6 +28,12 @@ public class TestLootTables {
@BeforeEach
public void init() {
try {
ResourceGatherer.ensureResourcesArePresent(MinecraftServer.VERSION_NAME);
} catch (IOException e) {
e.printStackTrace();
}
tableManager = new LootTableManager();
tableManager.registerConditionDeserializer(NamespaceID.from("minecraft:survives_explosion"), new SurvivesExplosionCondition.Deserializer());
tableManager.registerTableType(NamespaceID.from("minecraft:block"), new BlockType());