Give ItemStack context to IForgeItem.getCapabilityProvider (#10404)

This commit is contained in:
Jonathing authored and GitHub committed 2025-02-05 09:15:37 -08:00
1 parent b25f6e3a7c
commit 02e82c672d
2 files changed
+10 -1

No files matched your search

@@ -18,7 +18,7 @@
this.count = p_332766_;
this.components = p_333722_;
this.getItem().verifyComponentsAfterLoad(this);
+ gatherCapabilities(() -> this.item.getCapabilityProvider());
+ gatherCapabilities(() -> this.item.getCapabilityProvider(this));
}
private ItemStack(@Nullable Void p_282703_) {
@@ -615,9 +615,18 @@ public interface IForgeItem {
/**
* @return The Default Capability Provider for this item, if any.
*
* @deprecated Use the itemstack-sensitive version instead: {@link #getCapabilityProvider(ItemStack)}
*/
@Nullable
@Deprecated(forRemoval = true, since = "1.21.4")
default ICapabilityProvider getCapabilityProvider() {
return null;
}
/** @return The Default Capability Provider for this item, if any, accounting for the given itemstack. */
@Nullable
default ICapabilityProvider getCapabilityProvider(ItemStack stack) {
return this.getCapabilityProvider();
}
}