Skip to content

Commit

Permalink
Add additional tags to ItemMeta obfuscation filtering (PaperMC#9665)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sytm authored and lynxplay committed Feb 23, 2024
1 parent a712c24 commit 979748f
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 17 deletions.
11 changes: 9 additions & 2 deletions patches/server/0721-Hide-unnecessary-itemmeta-from-clients.patch
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ index e8ca93305e8baaee3e72932b630a2d6907444593..65f36454b08d7527aca0d3e667979fd5
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index f8738a28fb30c8fdb52ed3e6f8000144129c1f00..58186adba67a43188784efffd4bc9c8d98ac2848 100644
index f8738a28fb30c8fdb52ed3e6f8000144129c1f00..4dc9647b9c7206b1e98554d2db0f193b0dce0a94 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3196,7 +3196,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
Expand All @@ -45,7 +45,7 @@ index f8738a28fb30c8fdb52ed3e6f8000144129c1f00..58186adba67a43188784efffd4bc9c8d
// Paper end
switch (enumitemslot.getType()) {
case HAND:
@@ -3210,6 +3210,70 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3210,6 +3210,77 @@ public abstract class LivingEntity extends Entity implements Attackable {
((ServerLevel) this.level()).getChunkSource().broadcast(this, new ClientboundSetEquipmentPacket(this.getId(), list));
}

Expand Down Expand Up @@ -88,6 +88,8 @@ index f8738a28fb30c8fdb52ed3e6f8000144129c1f00..58186adba67a43188784efffd4bc9c8d
+ tag.put("Enchantments", enchantments);
+ }
+ tag.remove("AttributeModifiers");
+ tag.remove("Unbreakable");
+ tag.remove("PublicBukkitValues"); // Persistent data container1
+
+ // Books
+ tag.remove("author");
Expand All @@ -96,6 +98,11 @@ index f8738a28fb30c8fdb52ed3e6f8000144129c1f00..58186adba67a43188784efffd4bc9c8d
+ tag.remove("filtered_pages");
+ tag.remove("title");
+ tag.remove("generation");
+
+ // Filled maps
+ tag.remove("map");
+ tag.remove("map_scale_direction");
+ tag.remove("map_to_lock");
+ }
+ }
+
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0757-Freeze-Tick-Lock-API.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ index da8bd9746a3ddef673230c12370a34c8228aa0c7..a1e795810e7e49acf4959b9c88bed1f9

} catch (Throwable throwable) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 58186adba67a43188784efffd4bc9c8d98ac2848..7c686b6734d52287c3c41bfe0942761656da9e36 100644
index 4dc9647b9c7206b1e98554d2db0f193b0dce0a94..69fc62b95f068f498a0eb77cf951042ae159204f 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3446,7 +3446,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3453,7 +3453,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

this.level().getProfiler().pop();
this.level().getProfiler().push("freezing");
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0807-Add-PlayerStopUsingItemEvent.patch
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ Subject: [PATCH] Add PlayerStopUsingItemEvent


diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7c686b6734d52287c3c41bfe0942761656da9e36..4d7c0063000eb6c0469b837122c881a4a728629a 100644
index 69fc62b95f068f498a0eb77cf951042ae159204f..a483a9558b3f31c3712ea7d8519b8539b0cb0746 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -4019,6 +4019,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4026,6 +4026,7 @@ public abstract class LivingEntity extends Entity implements Attackable {

public void releaseUsingItem() {
if (!this.useItem.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ index 5803f7b286cd262a8f79d0adb159d897361275a2..42f0ea87dd0bb3be3fbe9e0f7d87582c
+ // Paper end
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index e25b6a9f50eea2e012315f5a395f369761117de5..34585981d45712d9119a97485ccc611d2c02e452 100644
index 9a82adb03cdb046f950ca63a029f9f3b6e04538c..4ed23c6143a96e75b0e2e060861dd7c702ce6a95 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3672,7 +3672,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3679,7 +3679,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
}

public void onItemPickup(ItemEntity item) {
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0957-Properly-Cancel-Usable-Items.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ index afbc246a2dc55f0f1576c0468118ef80671a034e..1c86eaf44e6c797a51e69f14e08bb9a3
return;
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 086626fc52fe22b1a7bdec5186f6801faf456eef..df0f723cd39c05ed8f2d1bbf6e97f3c640134274 100644
index 8b0d715d3adf4694cd93bbf1152dd2e20d3d44de..485b7c3e3a13ad8fdbf0b17fef31e05803f1615e 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3807,6 +3807,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3814,6 +3814,11 @@ public abstract class LivingEntity extends Entity implements Attackable {
return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND;
}

Expand Down
14 changes: 7 additions & 7 deletions patches/server/1028-Lag-compensation-ticks.patch
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ index 8f0769d248c7f3cce753130147223403c7923304..97745f0bab8d82d397c6c2a5775aed92
net.minecraft.world.level.block.entity.HopperBlockEntity.skipHopperEvents = worldserver.paperConfig().hopper.disableMoveEvent || org.bukkit.event.inventory.InventoryMoveItemEvent.getHandlerList().getRegisteredListeners().length == 0; // Paper
worldserver.hasEntityMoveEvent = io.papermc.paper.event.entity.EntityMoveEvent.getHandlerList().getRegisteredListeners().length > 0; // Paper
diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index a35b98e92a8afaa1d61e86a614466e64ef6e948f..47e8a6b28960883da868061ed649152ea792c184 100644
index 2858fe182e617429f7dcbd7b5d2d2f5df722d5bb..00b3d8cdf22ef6e1b6b93dc6ba228a9d8c918e6b 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -564,6 +564,17 @@ public class ServerLevel extends Level implements WorldGenLevel {
Expand Down Expand Up @@ -65,10 +65,10 @@ index 618ab9a2903f6d4139acd4aaa2e6db0a26e88ba9..b2c2bd5ec0afd479973f7237a5c610f2

if (this.hasDelayedDestroy) {
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index df0f723cd39c05ed8f2d1bbf6e97f3c640134274..77a1c7dfbaccc2e74da5c78ce4dfcd1717a7ac65 100644
index 485b7c3e3a13ad8fdbf0b17fef31e05803f1615e..b95f88d5e5b4785ee063695fd81935636a0588d1 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3812,6 +3812,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3819,6 +3819,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.getEntityData().resendPossiblyDesyncedDataValues(java.util.List.of(DATA_LIVING_ENTITY_FLAGS), serverPlayer);
}
// Paper end
Expand All @@ -79,7 +79,7 @@ index df0f723cd39c05ed8f2d1bbf6e97f3c640134274..77a1c7dfbaccc2e74da5c78ce4dfcd17
private void updatingUsingItem() {
if (this.isUsingItem()) {
if (ItemStack.isSameItem(this.getItemInHand(this.getUsedItemHand()), this.useItem)) {
@@ -3830,7 +3834,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3837,7 +3841,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
this.triggerItemUseEffects(stack, 5);
}

Expand All @@ -93,7 +93,7 @@ index df0f723cd39c05ed8f2d1bbf6e97f3c640134274..77a1c7dfbaccc2e74da5c78ce4dfcd17
this.completeUsingItem();
}

@@ -3878,7 +3887,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3885,7 +3894,10 @@ public abstract class LivingEntity extends Entity implements Attackable {

if (!itemstack.isEmpty() && !this.isUsingItem() || forceUpdate) { // Paper use override flag
this.useItem = itemstack;
Expand All @@ -105,7 +105,7 @@ index df0f723cd39c05ed8f2d1bbf6e97f3c640134274..77a1c7dfbaccc2e74da5c78ce4dfcd17
if (!this.level().isClientSide) {
this.setLivingEntityFlag(1, true);
this.setLivingEntityFlag(2, hand == InteractionHand.OFF_HAND);
@@ -3903,7 +3915,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3910,7 +3922,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
} else if (!this.isUsingItem() && !this.useItem.isEmpty()) {
this.useItem = ItemStack.EMPTY;
Expand All @@ -117,7 +117,7 @@ index df0f723cd39c05ed8f2d1bbf6e97f3c640134274..77a1c7dfbaccc2e74da5c78ce4dfcd17
}
}

@@ -4038,7 +4053,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -4045,7 +4060,10 @@ public abstract class LivingEntity extends Entity implements Attackable {
}

this.useItem = ItemStack.EMPTY;
Expand Down

0 comments on commit 979748f

Please sign in to comment.