ItemStack's constructors has both ItemLike and Holder<? extends Item> signatures, meaning that passing a DeferredItem into an ItemStack errors at compiletime as javac can't work out which constructor to use.
To rectify this, I propose adding two new methods to DeferredItem and DeferredBlock:
/**
* Creates a new {@link ItemStack} with a default size of 1 from this {@link Item}
*/
public ItemStack asItemStack() {
return asItemStack(1);
}
/**
* Creates a new {@link ItemStack} with the given size from this {@link Item}
*
* @param count The size of the stack to create
*/
public ItemStack asItemStack(int count) {
return new ItemStack(asItem(), count);
}
Pretty quick and easy
ItemStack's constructors has both ItemLike and Holder<? extends Item> signatures, meaning that passing a DeferredItem into an ItemStack errors at compiletime as javac can't work out which constructor to use.
To rectify this, I propose adding two new methods to DeferredItem and DeferredBlock: