Record Class LootInjection

java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.loot.LootInjection
Record Components:
targets - The list of destination LootTable resource keys to modify.
injections - The list of LootTable resource keys to inject as nested pools into targets.

public record LootInjection(List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets, List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> injections) extends Record
A data-driven record defining a loot table injection rule.

Specifies a list of target LootTable keys (such as vanilla chest loot tables) and a list of injection LootTable keys whose contents will be appended as nested loot pools to each target table upon server startup and datapack reload.

See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.Codec<LootInjection>
    The codec responsible for serializing and deserializing LootInjection definitions from JSON.
  • Constructor Summary

    Constructors
    Constructor
    Description
    LootInjection(List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets, List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> injections)
    Creates an instance of a LootInjection record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    final int
    Returns a hash code value for this object.
    List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>>
    Returns the value of the injections record component.
    List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>>
    Returns the value of the targets record component.
    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
  • Field Details

    • CODEC

      public static final com.mojang.serialization.Codec<LootInjection> CODEC
      The codec responsible for serializing and deserializing LootInjection definitions from JSON.
  • Constructor Details

    • LootInjection

      public LootInjection(List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets, List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> injections)
      Creates an instance of a LootInjection record class.
      Parameters:
      targets - the value for the targets record component
      injections - the value for the injections record component
  • Method Details

    • 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. All components in this record class are compared with Objects::equals(Object,Object).
      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.
    • targets

      public List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets()
      Returns the value of the targets record component.
      Returns:
      the value of the targets record component
    • injections

      public List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> injections()
      Returns the value of the injections record component.
      Returns:
      the value of the injections record component