Record Class LootTableHelper

java.lang.Object
java.lang.Record
net.darkhax.simplelootviewer.common.impl.data.LootTableHelper

public record LootTableHelper() extends Record
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates an instance of a LootTableHelper record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    static com.google.common.collect.ArrayListMultimap<LootType,TableInfo>
    collectData(net.minecraft.core.RegistryAccess registries)
    Collects all data on loot tables and stores it in a usable format for our plugin.
    final boolean
    Indicates whether some other object is "equal to" this one.
    static com.google.common.collect.ArrayListMultimap<LootType,TableInfo>
    getCachedData(net.minecraft.core.RegistryAccess registries)
    Gets a cached version of the loot table data.
    final int
    Returns a hash code value for this object.
    static Name
    nameTable(net.minecraft.resources.ResourceLocation tableKey, com.google.common.collect.ArrayListMultimap<net.minecraft.resources.ResourceLocation,net.minecraft.resources.ResourceLocation> blockTables, com.google.common.collect.ArrayListMultimap<net.minecraft.resources.ResourceLocation,net.minecraft.resources.ResourceLocation> entityTables)
    Creates a custom name for a loot table.
    static net.minecraft.network.chat.Component
    nameTableFromId(net.minecraft.resources.ResourceLocation tableKey)
    Creates a translatable name based on the ID of the loot table.
    final String
    Returns a string representation of this record class.

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, wait, wait, wait
  • Constructor Details

    • LootTableHelper

      public LootTableHelper()
      Creates an instance of a LootTableHelper record class.
  • Method Details

    • getCachedData

      public static com.google.common.collect.ArrayListMultimap<LootType,TableInfo> getCachedData(net.minecraft.core.RegistryAccess registries)
      Gets a cached version of the loot table data. The cache will be rebuilt if it is outdated.
      Parameters:
      registries - The current reloadable game registries. The loot table registry must be available.
      Returns:
      A multimap of info sorted by type of loot table.
    • collectData

      public static com.google.common.collect.ArrayListMultimap<LootType,TableInfo> collectData(net.minecraft.core.RegistryAccess registries)
      Collects all data on loot tables and stores it in a usable format for our plugin.
      Parameters:
      registries - The current reloadable game registries. The loot table registry must be available.
      Returns:
      A multimap of table info sorted by type of loot table.
    • nameTable

      public static Name nameTable(net.minecraft.resources.ResourceLocation tableKey, com.google.common.collect.ArrayListMultimap<net.minecraft.resources.ResourceLocation,net.minecraft.resources.ResourceLocation> blockTables, com.google.common.collect.ArrayListMultimap<net.minecraft.resources.ResourceLocation,net.minecraft.resources.ResourceLocation> entityTables)
      Creates a custom name for a loot table.
      Parameters:
      tableKey - The ID of the loot table.
      blockTables - A map of blocks that produce each loot table.
      entityTables - A map of entities that produce each loot table.
      Returns:
      A name for the loot table.
    • nameTableFromId

      public static net.minecraft.network.chat.Component nameTableFromId(net.minecraft.resources.ResourceLocation tableKey)
      Creates a translatable name based on the ID of the loot table. If the name is not translatable we will fall back to the ID of the table.
      Parameters:
      tableKey - The ID of the loot table.
      Returns:
      The name of the table.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal.
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.