Skip to content

Commit

Permalink
Clarify the usage of LootContextParamSets
Browse files Browse the repository at this point in the history
  • Loading branch information
hjake123 committed Oct 12, 2024
1 parent 51a9b76 commit 706cbc8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion docs/resources/server/enchantments/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,10 @@ Registering a custom `ConditionalEffect`-wrapped enchantment effect component ty
public static final DeferredHolder<DataComponentType<?>, DataComponentType<ConditionalEffect<Increment>>> CONDITIONAL_INCREMENT =
ENCHANTMENT_COMPONENT_TYPES.register("conditional_increment",
() -> DataComponentType.ConditionalEffect<Increment>builder()
.persistent(ConditionalEffect.codec(Increment.CODEC, LootContextParamSets.EMPTY))
// The LootContextParamSet needed depends on what the enchantment is supposed to do.
// This might be one of ENCHANTED_DAMAGE, ENCHANTED_ITEM, ENCHANTED_LOCATION, ENCHANTED_ENTITY, or HIT_BLOCK
// since all of these bring the enchantment level into context (along with whatever other information is indicated).
.persistent(ConditionalEffect.codec(Increment.CODEC, LootContextParamSets.ENCHANTED_DAMAGE))
.build());
```
The parameters to `ConditionalEffect.codec` are the codec for the generic `ConditionalEffect<T>`, followed by some `LootContextParamSets` entry.
Expand Down

1 comment on commit 706cbc8

@neoforged-pages-deployments
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Deploying with Cloudflare Pages

Name Result
Last commit: 706cbc8e92610edc8e27a6cf2d9ab9ada19ffa90
Status: ✅ Deploy successful!
Preview URL: https://dbcb7eb2.neoforged-docs-previews.pages.dev
PR Preview URL: https://pr-165.neoforged-docs-previews.pages.dev

Please sign in to comment.