Class AddTableLootModifier
java.lang.Object
net.neoforged.neoforge.common.loot.LootModifier
net.neoforged.neoforge.common.loot.AddTableLootModifier
- All Implemented Interfaces:
IGlobalLootModifier
Loot modifier that rolls one loot table (the "subtable" and adds the results to the loot being modified (the "target table"). Loot modifiers are not rolled for the subtable, as that could result in the subtables' items being modified twice (by downstream loot modifiers modifying the target table).
Json format:
{ "type": "neoforge:add_table", "conditions": [], // conditions block to predicate target tables by "table": "namespace:loot_table_id" // subtable to roll loot for to add to the target table(s) }
-
Field Summary
Modifier and TypeFieldDescriptionstatic final com.mojang.serialization.MapCodec
<AddTableLootModifier> private final ResourceKey
<LootTable> Fields inherited from class net.neoforged.neoforge.common.loot.LootModifier
conditions
Fields inherited from interface net.neoforged.neoforge.common.loot.IGlobalLootModifier
CONDITIONAL_CODEC, DIRECT_CODEC, LOOT_CONDITIONS_CODEC
-
Constructor Summary
ConstructorDescriptionAddTableLootModifier
(LootItemCondition[] conditionsIn, ResourceKey<LootTable> table) -
Method Summary
Modifier and TypeMethodDescriptioncom.mojang.serialization.MapCodec
<? extends IGlobalLootModifier> codec()
Returns the registered codec for this modifierprotected it.unimi.dsi.fastutil.objects.ObjectArrayList
<ItemStack> doApply
(it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> generatedLoot, LootContext context) Applies the modifier to the generated loot (all loot conditions have already been checked and have returned true).table()
Methods inherited from class net.neoforged.neoforge.common.loot.LootModifier
apply, codecStart
-
Field Details
-
CODEC
- See Also:
-
table
-
-
Constructor Details
-
AddTableLootModifier
-
-
Method Details
-
table
-
doApply
protected it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> doApply(it.unimi.dsi.fastutil.objects.ObjectArrayList<ItemStack> generatedLoot, LootContext context) Description copied from class:LootModifier
Applies the modifier to the generated loot (all loot conditions have already been checked and have returned true).- Specified by:
doApply
in classLootModifier
- 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
Description copied from interface:IGlobalLootModifier
Returns the registered codec for this modifier
-