Record Class LootInjection
java.lang.Object
java.lang.Record
johnsmith.enchantingoverhauled.api.loot.LootInjection
- Record Components:
targets- The list of destinationLootTableresource keys to modify.injections- The list ofLootTableresource keys to inject as nested pools intotargets.
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
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<LootInjection> The codec responsible for serializing and deserializingLootInjectiondefinitions from JSON. -
Constructor Summary
ConstructorsConstructorDescriptionLootInjection(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 aLootInjectionrecord class. -
Method Summary
Modifier and TypeMethodDescriptionfinal booleanIndicates whether some other object is "equal to" this one.final inthashCode()Returns a hash code value for this object.List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> Returns the value of theinjectionsrecord component.List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets()Returns the value of thetargetsrecord component.final StringtoString()Returns a string representation of this record class.
-
Field Details
-
CODEC
The codec responsible for serializing and deserializingLootInjectiondefinitions 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 aLootInjectionrecord class.- Parameters:
targets- the value for thetargetsrecord componentinjections- the value for theinjectionsrecord component
-
-
Method Details
-
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. -
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. -
equals
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 withObjects::equals(Object,Object). -
targets
public List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> targets()Returns the value of thetargetsrecord component.- Returns:
- the value of the
targetsrecord component
-
injections
public List<net.minecraft.resources.ResourceKey<net.minecraft.world.level.storage.loot.LootTable>> injections()Returns the value of theinjectionsrecord component.- Returns:
- the value of the
injectionsrecord component
-