Skip to content

Commit

Permalink
Rebase
Browse files Browse the repository at this point in the history
  • Loading branch information
Dreeam-qwq committed Aug 5, 2024
1 parent 39d617b commit bcd5cb4
Showing 1 changed file with 11 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,10 @@ index 855fa46cbaaa22003f46e0e63292ad0824d23c86..60ef9bf2425a8d6d54cd59ae15f3f378
}
}
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 7c75298c8ea7a828c2d9cd4e7ffd4d09a0113aed..6036c1a6f61d6c8a220ed97166c8741ea1922ab4 100644
index 8b0cd878d8bf633283b645dc06dfbb98c06e269f..bddfa152954b8ecdf5da233939f286f32e0b30e4 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -3388,7 +3388,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3404,7 +3404,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
ItemStack itemstack1 = itemstack;
ItemStack itemstack2 = this.getItemBySlot(enumitemslot);

Expand All @@ -90,7 +90,7 @@ index 7c75298c8ea7a828c2d9cd4e7ffd4d09a0113aed..6036c1a6f61d6c8a220ed97166c8741e
// Paper start - PlayerArmorChangeEvent
if (this instanceof ServerPlayer && enumitemslot.getType() == EquipmentSlot.Type.HUMANOID_ARMOR) {
final org.bukkit.inventory.ItemStack oldItem = CraftItemStack.asBukkitCopy(itemstack1);
@@ -3472,7 +3472,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
@@ -3488,7 +3488,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
equipmentChanges.forEach((enumitemslot, itemstack) -> {
ItemStack itemstack1 = itemstack.copy();

Expand Down Expand Up @@ -132,10 +132,10 @@ index c491291b522aebf34c7d990d2b485d1a0d19cdcd..267f638bb704002a30b1f5cb4e33b6a8
this.synchronizer.sendCarriedChange(this, this.remoteCarried);
diff --git a/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java b/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java
new file mode 100644
index 0000000000000000000000000000000000000000..d1c1bbd246ff2ec4e78ef3230762f2747a5e315e
index 0000000000000000000000000000000000000000..5847c24e127cd71aa026610c15f416aeff06feef
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/config/modules/misc/HiddenItemComponents.java
@@ -0,0 +1,43 @@
@@ -0,0 +1,46 @@
+package org.dreeam.leaf.config.modules.misc;
+
+import net.minecraft.core.component.DataComponentType;
Expand Down Expand Up @@ -167,24 +167,27 @@ index 0000000000000000000000000000000000000000..d1c1bbd246ff2ec4e78ef3230762f274
+ Also, it can avoid some frequent client animations.
+ NOTICE: You must know what you're filling in and how it works! It will handle all itemStacks!
+ """);
+
+ List<DataComponentType<?>> types = new ArrayList<>(list.size());
+
+ for (String id : list) {
+ // Find and check
+ DataComponentType<?> type = BuiltInRegistries.DATA_COMPONENT_TYPE.get(ResourceLocation.parse(id));
+ if (type != null) {
+ types.add(type);
+ } else LeafConfig.LOGGER.warn("Unknown component type: {}", id);
+ }
+
+ hiddenItemComponentTypes = types;
+ }
+
+}
diff --git a/src/main/java/org/dreeam/leaf/util/item/ItemStackObfuscator.java b/src/main/java/org/dreeam/leaf/util/item/ItemStackObfuscator.java
new file mode 100644
index 0000000000000000000000000000000000000000..4130aaf0df48b6f17206059a3343419f6bfbc0fe
index 0000000000000000000000000000000000000000..55cc252829bff893e6b0f564f3399f06267f7b8e
--- /dev/null
+++ b/src/main/java/org/dreeam/leaf/util/item/ItemStackObfuscator.java
@@ -0,0 +1,31 @@
@@ -0,0 +1,29 @@
+package org.dreeam.leaf.util.item;
+
+import net.minecraft.core.component.DataComponentType;
Expand All @@ -195,14 +198,14 @@ index 0000000000000000000000000000000000000000..4130aaf0df48b6f17206059a3343419f
+
+public class ItemStackObfuscator {
+
+ // Leaf start - Hide specified item components
+ public static ItemStack stripMeta(final ItemStack itemStack, final boolean copyItemStack) {
+ if (itemStack.isEmpty() || itemStack.getComponentsPatch().isEmpty()) return itemStack;
+
+ final ItemStack copy = copyItemStack ? itemStack.copy() : itemStack;
+
+ // Get the types which need to hide
+ List<DataComponentType<?>> hiddenTypes = HiddenItemComponents.hiddenItemComponentTypes;
+
+ if (hiddenTypes.isEmpty()) return copy;
+
+ // Remove specified types
Expand All @@ -213,6 +216,4 @@ index 0000000000000000000000000000000000000000..4130aaf0df48b6f17206059a3343419f
+
+ return copy;
+ }
+ // Leaf end - Hide specified item components
+
+}

0 comments on commit bcd5cb4

Please sign in to comment.