9
0
mirror of https://github.com/Winds-Studio/Leaf.git synced 2025-12-19 15:09:25 +00:00
Files
Leaf/leaf-archived-patches/unapplied/server/minecraft-patches/features/0079-Hide-specified-item-components.patch
Dreeam 236010caba Cooking Tutorial
1. Wet the drys
2. Dry the wets
3. Wet the drys
4. Dry the wets
5. Wet the drys
6. Now dust the wets
2025-03-28 03:11:27 -04:00

53 lines
3.7 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 e6419715fab462b12790ecb175ce1e1a1fceed8f..8a0d1aebad1f92c43112e279b9c5922fdd1fd432 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 (!this.matchesRemote(this.getCarried(), this.remoteCarried)) { // Paper - add flag to simplify remote matching logic
+ // 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)
+ : !this.matchesRemote(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);