-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Reimplement ItemStack Obfuscation #11817
Conversation
(needs docs PR) |
This implementation has been dramatically simplified, and now supports dropping components. So for example, unbreaking is now hidden. |
96734a2
to
4dd11f8
Compare
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) |
Indeed a weird nitpick. |
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_sword
dirt[max_damage=10]
->dirt
Sanitizing
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