Reset component prototype on itemtype change

This commit is contained in:
Jake Potrebic 2024-04-28 17:13:30 -07:00
parent 05308fc299
commit 69a971a35c
No known key found for this signature in database
GPG Key ID: ECE0B3C133C016C5

View File

@ -3,7 +3,25 @@ From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Sat, 27 Apr 2024 20:56:17 -0700
Subject: [PATCH] General ItemMeta fixes
== AT ==
private-f net/minecraft/world/item/ItemStack components
diff --git a/src/main/java/net/minecraft/world/item/ItemStack.java b/src/main/java/net/minecraft/world/item/ItemStack.java
index 8e2b3dd109dca3089cbce82cd3788874613a3230..a45389d64c04cd4c2a35fbc511595be0535a8665 100644
--- a/src/main/java/net/minecraft/world/item/ItemStack.java
+++ b/src/main/java/net/minecraft/world/item/ItemStack.java
@@ -1251,6 +1251,11 @@ public final class ItemStack implements DataComponentHolder {
public void setItem(Item item) {
this.bukkitStack = null; // Paper
this.item = item;
+ // Paper start - change base component prototype
+ final DataComponentPatch patch = this.getComponentsPatch();
+ this.components = new PatchedDataComponentMap(this.item.components());
+ this.applyComponents(patch);
+ // Paper end - change base component prototype
}
// CraftBukkit end
diff --git a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java
index b0421823684ff6b9474b81675742d2ee3b17edf7..285257421a6958b854ecaa468ed275d33990db3d 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/BlockEntity.java