mirror of
https://github.com/Winds-Studio/Leaf.git
synced 2025-12-19 15:09:25 +00:00
Paper Changes: PaperMC/Paper@c2bb144f Properly save level data async (#12530) PaperMC/Paper@e2ca4773 Remove simplify remote item matching option for now
53 lines
3.6 KiB
Diff
53 lines
3.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: TheFloodDragon <1610105206@qq.com>
|
|
Date: Fri, 7 Feb 2025 18:41:55 +0800
|
|
Subject: [PATCH] Hide specified item components
|
|
|
|
|
|
diff --git a/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java b/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
index 828fbe03e7beb860cd0816c7ac8adbffe196533b..f602c4c55483a189f973929b982f1834ca7e9952 100644
|
|
--- a/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
+++ b/net/minecraft/network/protocol/game/ClientboundContainerSetContentPacket.java
|
|
@@ -53,8 +53,8 @@ public class ClientboundContainerSetContentPacket implements Packet<ClientGamePa
|
|
private void write(RegistryFriendlyByteBuf buffer) {
|
|
buffer.writeContainerId(this.containerId);
|
|
buffer.writeVarInt(this.stateId);
|
|
- ItemStack.OPTIONAL_LIST_STREAM_CODEC.encode(buffer, this.items);
|
|
- ItemStack.OPTIONAL_STREAM_CODEC.encode(buffer, this.carriedItem);
|
|
+ ItemStack.OPTIONAL_LIST_STREAM_CODEC.encode(buffer, org.dreeam.leaf.util.item.ItemStackStripper.strip(this.items, true)); // Leaf - Hide specified item components
|
|
+ ItemStack.OPTIONAL_STREAM_CODEC.encode(buffer, org.dreeam.leaf.util.item.ItemStackStripper.strip(this.carriedItem, true)); // Leaf - Hide specified item components
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java b/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
index c1130f596cf3443eeb62eb1b12587172fe0859ee..18590e0b1d94ee3266637c5f3ab65ead4f8fb394 100644
|
|
--- a/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
+++ b/net/minecraft/network/protocol/game/ClientboundContainerSetSlotPacket.java
|
|
@@ -33,7 +33,7 @@ public class ClientboundContainerSetSlotPacket implements Packet<ClientGamePacke
|
|
buffer.writeContainerId(this.containerId);
|
|
buffer.writeVarInt(this.stateId);
|
|
buffer.writeShort(this.slot);
|
|
- ItemStack.OPTIONAL_STREAM_CODEC.encode(buffer, this.itemStack);
|
|
+ ItemStack.OPTIONAL_STREAM_CODEC.encode(buffer, org.dreeam.leaf.util.item.ItemStackStripper.strip(this.itemStack, true)); // Leaf - Hide specified item components
|
|
}
|
|
|
|
@Override
|
|
diff --git a/net/minecraft/world/inventory/AbstractContainerMenu.java b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
index 3dcd8df0b395a8fed8bc0cbe0ff78f4ae0056fd3..1e8a6b132926525fad405cbf3a2fab5d32e003e1 100644
|
|
--- a/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
+++ b/net/minecraft/world/inventory/AbstractContainerMenu.java
|
|
@@ -306,7 +306,12 @@ public abstract class AbstractContainerMenu {
|
|
|
|
private void synchronizeCarriedToRemote() {
|
|
if (!this.suppressRemoteUpdates) {
|
|
- if (!ItemStack.matches(this.getCarried(), this.remoteCarried)) {
|
|
+ // Leaf start - Hide specified item components - Avoid some frequent client animations
|
|
+ final boolean matchResult = org.dreeam.leaf.config.modules.gameplay.HideItemComponent.enabled
|
|
+ ? !org.dreeam.leaf.util.item.ItemStackStripper.matchesStripped(this.getCarried(), this.remoteCarried)
|
|
+ : ItemStack.matches(this.getCarried(), this.remoteCarried); // Paper - add flag to simplify remote matching logic
|
|
+ if (matchResult) {
|
|
+ // Leaf end - Hide specified item components - Avoid some frequent client animations
|
|
this.remoteCarried = this.getCarried().copy();
|
|
if (this.synchronizer != null) {
|
|
this.synchronizer.sendCarriedChange(this, this.remoteCarried);
|