Skip to content

Add MC 1.20.5+/1.21+ vanilla attribute support - #332

Open
Travja wants to merge 2 commits into
devfrom
split/07-vanilla-attributes
Open

Add MC 1.20.5+/1.21+ vanilla attribute support#332
Travja wants to merge 2 commits into
devfrom
split/07-vanilla-attributes

Conversation

@Travja

@Travja Travja commented Jul 23, 2026

Copy link
Copy Markdown
Contributor

Split out of #320 (piece 7/12, independent).

Adds Divinity stat types for the vanilla attributes introduced in recent Minecraft versions (scale, water/movement efficiency, sneaking speed, block/entity interaction range, block break speed, explosion knockback resistance, fall damage multiplier, flying speed, gravity, jump strength, max absorption, mining efficiency, oxygen bonus, safe fall distance, step height, submerged mining speed) and applies them as real Bukkit attribute modifiers (keyed by fixed UUIDs so they can be cleanly replaced on recalculation) during EntityStats#updateAll.

Also relocates item_stats/stats.yml to item_stats/stats/general_stats.yml (a stats/ subdirectory) and bakes the previously code-injected ARMOR_TOUGHNESS defaults directly into the shipped config, since the new vanilla-attribute stat entries live alongside it in the same file.

Backward compatibility

The stats.ymlgeneral_stats.yml relocation would otherwise orphan any server's customized file (a fresh default-only file would get written at the new path). Added an automatic one-time migration: if the old file exists and the new one doesn't, its content is copied forward before load, and the new vanilla-attribute entries are seeded via addMissing so migrated files still get the new attributes working out of the box without touching anything the admin already customized.

claude added 2 commits July 23, 2026 04:26
Adds Divinity stat types for the vanilla attributes introduced in
recent Minecraft versions (scale, water/movement efficiency, sneaking
speed, block/entity interaction range, block break speed, explosion
knockback resistance, fall damage multiplier, flying speed, gravity,
jump strength, max absorption, mining efficiency, oxygen bonus, safe
fall distance, step height, submerged mining speed) and applies them
as real Bukkit attribute modifiers (keyed by fixed UUIDs so they can
be cleanly replaced on recalculation) during EntityStats#updateAll.

Also relocates item_stats/stats.yml to item_stats/stats/general_stats.yml
(a stats/ subdirectory) and bakes the previously code-injected
ARMOR_TOUGHNESS defaults directly into the shipped config, since the
new vanilla-attribute stat entries live alongside it in the same file.
Relocating stats.yml under item_stats/stats/ would otherwise orphan
any server's customized file: on next start, JYML.loadOrExtract
would find nothing at the new path and write a fresh, default-only
general_stats.yml, silently discarding whatever names/formats/
capacities/enabled-toggles admins had tuned.

migrateLegacyStatsFile() copies the old file to the new location
before it's loaded, if the old file exists and the new one doesn't
yet — a one-time, additive operation (the old file is left in place,
nothing is deleted). Config then seeds the new MC 1.20.5+/1.21+
vanilla-attribute stat entries via addMissing so a migrated file
still picks up the new attributes with their shipped defaults,
without touching any entry the admin already customized.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants