Strip coordinates from lodestone compasses (#8561)

This commit is contained in:
Noah van der Aa 2022-11-19 22:41:09 +01:00
parent 0bb4b6ead5
commit 14d69488ad
2 changed files with 13 additions and 1 deletions

View file

@ -63,12 +63,12 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ }
+ }
+
+ final CompoundTag tag = copy.getTag();
+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmeta) {
+ // Some resource packs show different textures when there is more than one item. Since this shouldn't provide a big advantage,
+ // we'll tell the client if there's one or (more than) two items.
+ copy.setCount(copy.getCount() > 1 ? 2 : 1);
+ // We can't just strip out display, leather helmets still use the display.color tag.
+ final CompoundTag tag = copy.getTag();
+ if (tag != null) {
+ if (tag.get("display") instanceof CompoundTag displayTag) {
+ displayTag.remove("Lore");
@ -98,6 +98,17 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ tag.remove("generation");
+ }
+ }
+
+ if (level.paperConfig().anticheat.obfuscation.items.hideItemmetaWithVisualEffects && tag != null) {
+ // Lodestone compasses
+ tag.remove("LodestonePos");
+ if (tag.contains("LodestoneDimension")) {
+ // The client shows the glint if either the position or the dimension is present, so we just wipe
+ // the position and fake the dimension
+ tag.putString("LodestoneDimension", "paper:paper");
+ }
+ }
+
+ return copy;
+ }
+ // Paper end

View file

@ -1515,6 +1515,7 @@ index 0000000000000000000000000000000000000000..00000000000000000000000000000000
+ public class Items extends ConfigurationPart {
+ public boolean hideItemmeta = false;
+ public boolean hideDurability = false;
+ public boolean hideItemmetaWithVisualEffects = false;
+ }
+ }
+