SPIGOT-4872: LootTables missing a few loot tables

By: md_5 <git@md-5.net>
This commit is contained in:
Bukkit/Spigot
2019-05-06 08:40:10 +10:00
parent e917cff666
commit 4ed27a6eca
4 changed files with 73 additions and 11 deletions

View File

@@ -1,9 +1,11 @@
package org.bukkit;
import com.google.common.base.Predicates;
import com.google.common.collect.ImmutableMap;
import java.util.Arrays;
import java.util.Iterator;
import java.util.Map;
import java.util.function.Predicate;
import org.bukkit.advancement.Advancement;
import org.bukkit.block.Biome;
import org.bukkit.boss.KeyedBossBar;
@@ -98,7 +100,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see EntityType
*/
Registry<EntityType> ENTITY_TYPE = new SimpleRegistry<>(EntityType.class);
Registry<EntityType> ENTITY_TYPE = new SimpleRegistry<>(EntityType.class, (entity) -> entity != EntityType.UNKNOWN);
/**
* Default server loot tables.
*
@@ -110,7 +112,7 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
*
* @see Material
*/
Registry<Material> MATERIAL = new SimpleRegistry<>(Material.class);
Registry<Material> MATERIAL = new SimpleRegistry<>(Material.class, (mat) -> !mat.isLegacy());
/**
* Server statistics.
*
@@ -144,10 +146,16 @@ public interface Registry<T extends Keyed> extends Iterable<T> {
private final Map<NamespacedKey, T> map;
protected SimpleRegistry(@NotNull Class<T> type) {
this(type, Predicates.<T>alwaysTrue());
}
protected SimpleRegistry(@NotNull Class<T> type, @NotNull Predicate<T> predicate) {
ImmutableMap.Builder<NamespacedKey, T> builder = ImmutableMap.builder();
for (T entry : type.getEnumConstants()) {
builder.put(entry.getKey(), entry);
if (predicate.test(entry)) {
builder.put(entry.getKey(), entry);
}
}
map = builder.build();

View File

@@ -25,6 +25,7 @@ public enum LootTables implements Keyed {
JUNGLE_TEMPLE("chests/jungle_temple"),
JUNGLE_TEMPLE_DISPENSER("chests/jungle_temple_dispenser"),
NETHER_BRIDGE("chests/nether_bridge"),
PILLAGER_OUTPOST("chests/pillager_outpost"),
SHIPWRECK_MAP("chests/shipwreck_map"),
SHIPWRECK_SUPPLY("chests/shipwreck_supply"),
SHIPWRECK_TREASURE("chests/shipwreck_treasure"),
@@ -35,11 +36,28 @@ public enum LootTables implements Keyed {
STRONGHOLD_LIBRARY("chests/stronghold_library"),
UNDERWATER_RUIN_BIG("chests/underwater_ruin_big"),
UNDERWATER_RUIN_SMALL("chests/underwater_ruin_small"),
VILLAGE_BLACKSMITH("chests/village_blacksmith"),
VILLAGE_ARMORER("chests/village/village_armorer"),
VILLAGE_BUTCHER("chests/village/village_butcher"),
VILLAGE_CARTOGRAPHER("chests/village/village_cartographer"),
VILLAGE_DESERT_HOUSE("chests/village/village_desert_house"),
VILLAGE_FISHER("chests/village/village_fisher"),
VILLAGE_FLETCHER("chests/village/village_fletcher"),
VILLAGE_MASON("chests/village/village_mason"),
VILLAGE_PLAINS_HOUSE("chests/village/village_plains_house"),
VILLAGE_SAVANNA_HOUSE("chests/village/village_savanna_house"),
VILLAGE_SHEPHERD("chests/village/village_shepherd"),
VILLAGE_SNOWY_HOUSE("chests/village/village_snowy_house"),
VILLAGE_TAIGA_HOUSE("chests/village/village_taiga_house"),
VILLAGE_TANNERY("chests/village/village_tannery"),
VILLAGE_TEMPLE("chests/village/village_temple"),
VILLAGE_TOOLSMITH("chests/village/village_toolsmith"),
VILLAGE_WEAPONSMITH("chests/village/village_weaponsmith"),
WOODLAND_MANSION("chests/woodland_mansion"),
// Entities
ARMOR_STAND("entities/armor_stand"),
BAT("entities/bat"),
BLAZE("entities/blaze"),
CAT("entities/cat"),
CAVE_SPIDER("entities/cave_spider"),
CHICKEN("entities/chicken"),
COD("entities/cod"),
@@ -53,23 +71,28 @@ public enum LootTables implements Keyed {
ENDERMITE("entities/endermite"),
ENDER_DRAGON("entities/ender_dragon"),
EVOKER("entities/evoker"),
FOX("entities/fox"),
GHAST("entities/ghast"),
GIANT("entities/giant"),
GUARDIAN("entities/guardian"),
HORSE("entities/horse"),
HUSK("entities/husk"),
ILLUSIONER("entities/illusioner"),
IRON_GOLEM("entities/iron_golem"),
LLAMA("entities/llama"),
MAGMA_CUBE("entities/magma_cube"),
MOOSHROOM("entities/mooshroom"),
MULE("entities/mule"),
MUSHROOM_COW("entities/mushroom_cow"),
OCELOT("entities/ocelot"),
PANDA("entities/panda"),
PARROT("entities/parrot"),
PHANTOM("entities/phantom"),
PIG("entities/pig"),
PILLAGER("entities/pillager"),
POLAR_BEAR("entities/polar_bear"),
PUFFERFISH("entities/pufferfish"),
RABBIT("entities/rabbit"),
RAVAGER("entities/ravager"),
SALMON("entities/salmon"),
// Sheep entry here, moved below for organizational purposes
SHULKER("entities/shulker"),
@@ -81,12 +104,15 @@ public enum LootTables implements Keyed {
SPIDER("entities/spider"),
SQUID("entities/squid"),
STRAY("entities/stray"),
TRADER_LLAMA("entities/trader_llama"),
TROPICAL_FISH("entities/tropical_fish"),
TURTLE("entities/turtle"),
VEX("entities/vex"),
VILLAGER("entities/villager"),
VINDICATOR("entities/vindicator"),
WANDERING_TRADER("entities/wandering_trader"),
WITCH("entities/witch"),
WITHER("entities/wither"),
WITHER_SKELETON("entities/wither_skeleton"),
WOLF("entities/wolf"),
ZOMBIE("entities/zombie"),
@@ -94,10 +120,24 @@ public enum LootTables implements Keyed {
ZOMBIE_PIGMAN("entities/zombie_pigman"),
ZOMBIE_VILLAGER("entities/zombie_villager"),
// Gameplay
ARMORER_GIFT("gameplay/hero_of_the_village/armorer_gift"),
BUTCHER_GIFT("gameplay/hero_of_the_village/butcher_gift"),
CARTOGRAPHER_GIFT("gameplay/hero_of_the_village/cartographer_gift"),
CAT_MORNING_GIFT("gameplay/cat_morning_gift"),
CLERIC_GIFT("gameplay/hero_of_the_village/cleric_gift"),
FARMER_GIFT("gameplay/hero_of_the_village/farmer_gift"),
FISHERMAN_GIFT("gameplay/hero_of_the_village/fisherman_gift"),
FISHING("gameplay/fishing"),
FISHING_FISH("gameplay/fishing/fish"),
FISHING_JUNK("gameplay/fishing/junk"),
FISHING_TREASURE("gameplay/fishing/treasure"),
FLETCHER_GIFT("gameplay/hero_of_the_village/fletcher_gift"),
LEATHERWORKER_GIFT("gameplay/hero_of_the_village/leatherworker_gift"),
LIBRARIAN_GIFT("gameplay/hero_of_the_village/librarian_gift"),
MASON_GIFT("gameplay/hero_of_the_village/mason_gift"),
SHEPHERD_GIFT("gameplay/hero_of_the_village/shepherd_gift"),
TOOLSMITH_GIFT("gameplay/hero_of_the_village/toolsmith_gift"),
WEAPONSMITH_GIFT("gameplay/hero_of_the_village/weaponsmith_gift"),
// Sheep
SHEEP("entities/sheep"),
SHEEP_BLACK("entities/sheep/black"),
@@ -107,6 +147,7 @@ public enum LootTables implements Keyed {
SHEEP_GRAY("entities/sheep/gray"),
SHEEP_GREEN("entities/sheep/green"),
SHEEP_LIGHT_BLUE("entities/sheep/light_blue"),
SHEEP_LIGHT_GRAY("entities/sheep/light_gray"),
SHEEP_LIME("entities/sheep/lime"),
SHEEP_MAGENTA("entities/sheep/magenta"),
SHEEP_ORANGE("entities/sheep/orange"),