mirror of
https://github.com/MinecraftForge/MinecraftForge
synced 2026-08-22 04:26:10 -04:00
Give ItemStack context to IForgeItem.getCapabilityProvider (#10404)
This commit is contained in:
parent
b25f6e3a7c
commit
02e82c672d
2 changed files with 10 additions and 1 deletions
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue