2020-08-23 15:38:40 +02:00
|
|
|
package mod.acgaming.spackenmobs.misc;
|
|
|
|
|
|
|
|
import com.google.common.collect.Sets;
|
|
|
|
import net.minecraft.util.ResourceLocation;
|
|
|
|
import net.minecraft.world.storage.loot.LootTable;
|
|
|
|
import net.minecraft.world.storage.loot.LootTableManager;
|
|
|
|
|
2020-08-29 17:36:56 +02:00
|
|
|
import java.io.File;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Set;
|
|
|
|
|
|
|
|
public class ModLootTableList {
|
|
|
|
private static final Set<ResourceLocation> LOOT_TABLES = Sets.<ResourceLocation>newHashSet();
|
|
|
|
public static final ResourceLocation EMPTY = register("empty");
|
|
|
|
public static final ResourceLocation ENTITIES_JENS = register("entities/jens");
|
|
|
|
private static final Set<ResourceLocation> READ_ONLY_LOOT_TABLES = Collections.<ResourceLocation>unmodifiableSet(LOOT_TABLES);
|
|
|
|
|
|
|
|
public static Set<ResourceLocation> getAll() {
|
|
|
|
return READ_ONLY_LOOT_TABLES;
|
|
|
|
}
|
|
|
|
|
|
|
|
public static ResourceLocation register(ResourceLocation id) {
|
|
|
|
if(LOOT_TABLES.add(id)) {
|
|
|
|
return id;
|
|
|
|
}else {
|
|
|
|
throw new IllegalArgumentException(id + " is already a registered built-in loot table");
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private static ResourceLocation register(String id) {
|
|
|
|
return register(new ResourceLocation("spackenmobs", id));
|
|
|
|
}
|
|
|
|
|
|
|
|
public static boolean test() {
|
|
|
|
LootTableManager loottablemanager = new LootTableManager((File)null);
|
|
|
|
|
|
|
|
for(ResourceLocation resourcelocation : READ_ONLY_LOOT_TABLES) {
|
|
|
|
if(loottablemanager.getLootTableFromLocation(resourcelocation) == LootTable.EMPTY_LOOT_TABLE) {
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2020-08-23 15:38:40 +02:00
|
|
|
}
|