Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for slotted attributes #1447

Merged
merged 1 commit into from
Nov 28, 2024
Merged

Add support for slotted attributes #1447

merged 1 commit into from
Nov 28, 2024

Conversation

Pablete1234
Copy link
Member

@Pablete1234 Pablete1234 commented Nov 28, 2024

Fixes #1446

Allows attributes to specify a slot that the item has to be in to work:

<attribute amount="3" slot="mainhand">generic.attackDamage</attribute>

Note: This will only work when running in modern paper, legacy (1.8) minecraft didn't have support for this.

Slots can be specified using EquipmentSlotGroup which is the modern way, allowing for things like armor (for any armor piece) or hand (for either hand), but it also, for backwards-compat reasons, supports slots too like slot.armor.head.

Modern values (recommended)

any -> any equipment slot, the default if you don't set one
mainhand
offhand
hand  -> either main or off-hand
feet
legs
chest
head
armor -> any armor piece
body -> Used for entities with no feet/legs/chest/head distinction (eg: horses when they wear armor)

Legacy (deprecated) slots

They only work for backwards-compat reasons, and realistically do not need to be documented, focus on documenting the above ones instead.

All of these may have the slot. prefix, or not, like weapon.mainhand or slot.weapon.mainhand:

weapon.mainhand
weapon.offhand
armor.feet
armor.legs
armor.chest
armor.head

Signed-off-by: Pablo Herrera <pabloherrerapalacio@gmail.com>
}
}

public abstract static class Player extends Slot {
Copy link
Member

Choose a reason for hiding this comment

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

Interesting use of composition

@Pablete1234 Pablete1234 merged commit 79dfcfc into dev Nov 28, 2024
2 checks passed
@Pablete1234 Pablete1234 deleted the add-slot-attributes branch November 28, 2024 08:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Implement slot-specific attribute modifiers
2 participants