Interface IGlobalLootModifier
- All Known Implementing Classes:
AddTableLootModifier, LootModifier
public interface IGlobalLootModifier
Implementation that defines what a global loot modifier must implement in order to be functional.
Requires a
LootModifier Supplies base functionality; most modders should only need to extend that.Requires a
Codec to be registered: NeoForgeRegistries.GLOBAL_LOOT_MODIFIER_SERIALIZERS, and returned in codec()
Individual instances of modifiers must be registered via json, see neoforge:loot_modifiers/global_loot_modifiers-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final com.mojang.serialization.Codec<Optional<WithConditions<IGlobalLootModifier>>> static final intThe "default" priority for a loot modifier.static final com.mojang.serialization.Codec<IGlobalLootModifier> static final com.mojang.serialization.Codec<LootItemCondition[]> -
Method Summary
Modifier and TypeMethodDescriptionit.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> apply(it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> generatedLoot, LootContext context) Applies the modifier to the list of generated loot.com.mojang.serialization.MapCodec<? extends IGlobalLootModifier> codec()Returns the registered codec for this modifierintpriority()Returns the priority of this loot modifier.
-
Field Details
-
DIRECT_CODEC
-
CONDITIONAL_CODEC
static final com.mojang.serialization.Codec<Optional<WithConditions<IGlobalLootModifier>>> CONDITIONAL_CODEC -
LOOT_CONDITIONS_CODEC
-
DEFAULT_PRIORITY
static final int DEFAULT_PRIORITYThe "default" priority for a loot modifier. Seepriority()for more info.- See Also:
-
-
Method Details
-
apply
it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> apply(it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> generatedLoot, LootContext context) Applies the modifier to the list of generated loot. This function needs to be responsible for checking ILootConditions as well.- Parameters:
generatedLoot- the list of ItemStacks that will be dropped, generated by loot tablescontext- the LootContext, identical to what is passed to loot tables- Returns:
- modified loot drops
-
codec
com.mojang.serialization.MapCodec<? extends IGlobalLootModifier> codec()Returns the registered codec for this modifier -
priority
int priority()Returns the priority of this loot modifier. Modifiers with a higher priority will be applied first. Modifiers with equal priority will be applied in an undefined order.The canonical "default" priority value is 1000, per
DEFAULT_PRIORITY.
-