Reimplement ItemStack Obfuscation#11817
Merged
Merged
Conversation
Member
|
(needs docs PR) |
Member
Author
|
This implementation has been dramatically simplified, and now supports dropping components. So for example, unbreaking is now hidden. |
Member
Author
96734a2 to
4dd11f8
Compare
lynxplay
approved these changes
Jan 4, 2025
Machine-Maker
approved these changes
Jan 4, 2025
This general principal is that there is no mutation of the patched map, only swapping of the valid values. Additional work will need to be done to support hiding enchantments whilst keeping the glint, as we either have to append an enchantment, or need to add a glint override.. which kinda defeats the purpose above. Cant add a vanilla enchantment because those can be removed! Further investigation needed.
16dbb25 to
99aedfe
Compare
|
weird nitpick but why is it so complex? item obfuscation session, switching contexts, item obfuscation bindings, just seems like it might cause issues with maintenance in future (kind of like how anti-xray is complex, to a lesser extent though) |
Contributor
|
Indeed a weird nitpick. |
4 tasks
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.
Due to the amount of changes to items in the past updates, the previous configuration for obfuscation does not really fit today's representation of items.
This reimplements ItemStack obfuscation in a way that is built in mind to support the new 1.21.4 ItemModel format.
The following data components are obfuscated by default when enabled:
Unlike before, obfuscation for data components can now be configured on a per item model basis. So for example, items with the elytra item model will not obfuscate their damage component in order for their item model to properly read the damage value.
Default Obfuscation Behavior
Patched data component values are either DROPPED or SANITIZED.
Most values are dropped, unless certain behavior restricts them from being just dropped.
Dropping (standard)
Dropping occurs when the type can be freely removed from the item without any visual/behavioral changes.
Examples:
diamond_sword[max_damage=10]->diamond_sworddirt[max_damage=10]->dirtSanitizing
Certain components have serious behavior changes when dropped. So these types are instead mutated.
For example:
minecraft:diamond_sword[enchantments={levels:{"minecraft:sharpness":1, "minecraft:unbreaking":1}}]->minecraft:diamond_sword[enchantments={levels:{"minecraft:frost_walker":1}}](when configured)
minecraft:compass[lodestone_tracker={target: {dimension: "minecraft:overworld", pos: [I; 117, 160, -518]}}]->minecraft:compass[lodestone_tracker={tracked: 0b}]Tradeoff
The issue with this new system is that new types cannot be added, only removed/mutated.
Finally
Please provide any feedback on this new system, as this is a bit different and want to make sure that it is the best for people migrating from the old system. And additionally which new components people would like obfuscated by default.😄
Download the paperclip jar for this pull request: paper-11817.zip