Class LootTableAnalyzer
java.lang.Object
com.minecolonies.core.colony.crafting.LootTableAnalyzer
Utility helper that analyzes a loot table to determine a likely list of drops, along with
their drop rate, for presentation in JEI (and perhaps other purposes). This is just
informational and in particular shouldn't be used to actually generate loot -- due to
constraints with how loot tables are stored this can only produce an approximation of a
subset of possible loot results. Good enough to be indicative but that's all.
Currently it only supports a very limited set of conditions and properties; just enough
for current usage by MineColonies recipes. If tables are extended with additional
conditions or properties then this would have to be adjusted to cope as well.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classRepresents a single possible drop from a loot table. -
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull List<LootTableAnalyzer.LootDrop>consolidate(@NotNull List<LootTableAnalyzer.LootDrop> input) Groups and sorts drops by probability (most likely first, with similar-probability items in the same "slot" as alternatives).static List<LootTableAnalyzer.LootDrop>toDrops(@NotNull net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull net.minecraft.resources.ResourceLocation lootTableId) Evaluate a loot table and report possible drops.static List<LootTableAnalyzer.LootDrop>toDrops(@Nullable net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull com.google.gson.JsonObject lootTableJson) Evaluate a loot table and report possible drops.static List<LootTableAnalyzer.LootDrop>toDrops(@Nullable net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull net.minecraft.world.level.storage.loot.LootTable lootTable) Evaluate a loot table and report possible drops.
-
Method Details
-
toDrops
public static List<LootTableAnalyzer.LootDrop> toDrops(@NotNull @NotNull net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull @NotNull net.minecraft.resources.ResourceLocation lootTableId) Evaluate a loot table and report possible drops.- Parameters:
lootTableManager- theLootDataManagerlootTableId- the loot table id- Returns:
- the list of possible drops
-
toDrops
public static List<LootTableAnalyzer.LootDrop> toDrops(@Nullable @Nullable net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull @NotNull net.minecraft.world.level.storage.loot.LootTable lootTable) Evaluate a loot table and report possible drops.- Parameters:
lootTableManager- theLootDataManagerlootTable- the loot table- Returns:
- the list of possible drops
-
toDrops
public static List<LootTableAnalyzer.LootDrop> toDrops(@Nullable @Nullable net.minecraft.world.level.storage.loot.LootDataManager lootTableManager, @NotNull @NotNull com.google.gson.JsonObject lootTableJson) Evaluate a loot table and report possible drops.- Parameters:
lootTableManager- theLootDataManagerlootTableJson- the loot table json- Returns:
- the list of possible drops
-
consolidate
@NotNull public static @NotNull List<LootTableAnalyzer.LootDrop> consolidate(@NotNull @NotNull List<LootTableAnalyzer.LootDrop> input) Groups and sorts drops by probability (most likely first, with similar-probability items in the same "slot" as alternatives).- Parameters:
input- the unsorted list of drops- Returns:
- the sorted list of drops
-