Add MC 1.20.5+/1.21+ vanilla attribute support - #332
Open
Travja wants to merge 2 commits into
Open
Conversation
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.ymltoitem_stats/stats/general_stats.yml(astats/subdirectory) and bakes the previously code-injectedARMOR_TOUGHNESSdefaults directly into the shipped config, since the new vanilla-attribute stat entries live alongside it in the same file.Backward compatibility
The
stats.yml→general_stats.ymlrelocation 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 viaaddMissingso migrated files still get the new attributes working out of the box without touching anything the admin already customized.