Record Class LootTableRewardGenerator

java.lang.Object
java.lang.Record
com.petrolpark.core.data.reward.generator.LootTableRewardGenerator
All Implemented Interfaces:
ILootTableAccessor, IContextEntityRewardGenerator, IRewardGenerator, net.minecraft.world.level.storage.loot.LootContextUser

public record LootTableRewardGenerator(IEntityTarget target, List<net.minecraft.world.level.storage.loot.functions.LootItemFunction> lateFunctions, com.mojang.datafixers.util.Either<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>,net.minecraft.world.level.storage.loot.LootTable> lootTable) extends Record implements IContextEntityRewardGenerator, ILootTableAccessor
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    static final com.mojang.serialization.MapCodec<LootTableRewardGenerator>
     

    Fields inherited from interface com.petrolpark.core.data.reward.generator.IRewardGenerator

    TYPED_CODEC
  • Constructor Summary

    Constructors
    Constructor
    Description
    LootTableRewardGenerator(IEntityTarget target, List<net.minecraft.world.level.storage.loot.functions.LootItemFunction> lateFunctions, com.mojang.datafixers.util.Either<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>,net.minecraft.world.level.storage.loot.LootTable> lootTable)
    Creates an instance of a LootTableRewardGenerator record class.
  • Method Summary

    Modifier and Type
    Method
    Description
    final boolean
    Indicates whether some other object is "equal to" this one.
    generate(net.minecraft.world.level.storage.loot.LootContext context)
     
     
    final int
    Returns a hash code value for this object.
    List<net.minecraft.world.level.storage.loot.functions.LootItemFunction>
    Returns the value of the lateFunctions record component.
    com.mojang.datafixers.util.Either<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>,net.minecraft.world.level.storage.loot.LootTable>
    Returns the value of the lootTable record component.
    Returns the value of the target 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

    Methods inherited from interface com.petrolpark.core.data.reward.generator.IContextEntityRewardGenerator

    getReferencedContextParams

    Methods inherited from interface com.petrolpark.core.data.loot.ILootTableAccessor

    getLootTable

    Methods inherited from interface net.minecraft.world.level.storage.loot.LootContextUser

    validate
  • Field Details

  • Constructor Details

    • LootTableRewardGenerator

      public LootTableRewardGenerator(IEntityTarget target, List<net.minecraft.world.level.storage.loot.functions.LootItemFunction> lateFunctions, com.mojang.datafixers.util.Either<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>,net.minecraft.world.level.storage.loot.LootTable> lootTable)
      Creates an instance of a LootTableRewardGenerator record class.
      Parameters:
      target - the value for the target record component
      lateFunctions - the value for the lateFunctions record component
      lootTable - the value for the lootTable record component
  • Method Details

    • generate

      public List<IReward> generate(net.minecraft.world.level.storage.loot.LootContext context)
      Specified by:
      generate in interface IRewardGenerator
    • getType

      public RewardGeneratorType getType()
      Specified by:
      getType in interface IRewardGenerator
    • 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.
    • target

      public IEntityTarget target()
      Returns the value of the target record component.
      Specified by:
      target in interface IContextEntityRewardGenerator
      Returns:
      the value of the target record component
    • lateFunctions

      public List<net.minecraft.world.level.storage.loot.functions.LootItemFunction> lateFunctions()
      Returns the value of the lateFunctions record component.
      Returns:
      the value of the lateFunctions record component
    • lootTable

      public com.mojang.datafixers.util.Either<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>,net.minecraft.world.level.storage.loot.LootTable> lootTable()
      Returns the value of the lootTable record component.
      Specified by:
      lootTable in interface ILootTableAccessor
      Returns:
      the value of the lootTable record component