SPIGOT-7654: ItemStack#isSimilar does not work with empty BlockStateMeta

By: md_5 <git@md-5.net>
This commit is contained in:
CraftBukkit/Spigot
2024-05-02 21:22:32 +10:00
parent 54dd884d80
commit de3b4d1800
3 changed files with 36 additions and 36 deletions

View File

@@ -49,7 +49,18 @@
return nbttagcompound;
}
@@ -265,7 +289,7 @@
@@ -260,12 +284,18 @@
}
public final void applyComponents(DataComponentMap datacomponentmap, DataComponentPatch datacomponentpatch) {
+ // CraftBukkit start
+ this.applyComponentsSet(datacomponentmap, datacomponentpatch);
+ }
+
+ public final Set<DataComponentType<?>> applyComponentsSet(DataComponentMap datacomponentmap, DataComponentPatch datacomponentpatch) {
+ // CraftBukkit end
final Set<DataComponentType<?>> set = new HashSet();
set.add(DataComponents.BLOCK_ENTITY_DATA);
final PatchedDataComponentMap patcheddatacomponentmap = PatchedDataComponentMap.fromPatch(datacomponentmap, datacomponentpatch);
@@ -58,7 +69,18 @@
@Nullable
@Override
public <T> T get(DataComponentType<T> datacomponenttype) {
@@ -317,6 +341,15 @@
@@ -283,6 +313,10 @@
DataComponentPatch datacomponentpatch1 = datacomponentpatch.forget(set::contains);
this.components = datacomponentpatch1.split().added();
+ // CraftBukkit start
+ set.remove(DataComponents.BLOCK_ENTITY_DATA); // Remove as never actually added by applyImplicitComponents
+ return set;
+ // CraftBukkit end
}
protected void collectImplicitComponents(DataComponentMap.a datacomponentmap_a) {}
@@ -317,6 +351,15 @@
}
}