接口 ItemType.Typed<M extends ItemMeta>

类型参数:
M - 代表此物品类型的物品元数据的泛型类型。
所有超级接口:
ItemType, Keyed, RegistryAware, Translatable
封闭接口:
ItemType

public static interface ItemType.Typed<M extends ItemMeta> extends ItemType
Typed 代表 ItemType 的一个子类型,在编译时具有已知的物品元数据类型。
  • 方法详细资料

    • getItemMetaClass

      @NotNull @NotNull Class<M> getItemMetaClass()
      获取此 ItemType 的 ItemMeta 类。

      原文:Gets the ItemMeta class of this ItemType

      指定者:
      getItemMetaClass 在接口中 ItemType
      返回:
      此 ItemType 的 ItemMeta 类
    • createItemStack

      @NotNull @NotNull ItemStack createItemStack(@Nullable @Nullable Consumer<? super M> metaConfigurator)
      使用此物品类型创建数量为 1 的新物品堆。

      原文:Constructs a new item stack with this item type with the amount 1.

      参数:
      metaConfigurator - 一个可选的物品 ItemMeta 消费者,会被调用。 如果此时无意修改物品元数据,则可以为 null。
      返回:
      创建并配置好的物品堆。
    • createItemStack

      @NotNull @NotNull ItemStack createItemStack(int amount, @Nullable @Nullable Consumer<? super M> metaConfigurator)
      使用此物品类型创建新物品堆。

      原文:Constructs a new item stack with this item type.

      参数:
      amount - 物品堆的数量。
      metaConfigurator - 一个可选的物品 ItemMeta 消费者,会被调用。 如果此时无意修改物品元数据,则可以为 null。
      返回:
      创建并配置好的物品堆。