Class PaperItems
java.lang.Object
fr.robie.machineengine.api.paper.PaperItems
Converts between Paper
ItemStacks and Items.ITEM resources (ยง23.4).-
Method Summary
Modifier and TypeMethodDescriptionstatic @NotNull List<ResourceStack> drop(@NotNull org.bukkit.World world, int x, int y, int z, @NotNull List<ResourceStack> resources) Drops the item resources amongresourcesat the block's position (owner thread).static @NotNull net.kyori.adventure.key.KeyidOf(@NotNull org.bukkit.inventory.ItemStack stack) The item's id: a CraftEngine custom id for CraftEngine items, else the material key.static @Nullable org.bukkit.inventory.ItemStackitemOf(@NotNull net.kyori.adventure.key.Key id) One item with this id (CraftEngine or vanilla), ornullif there is none.static voidsetIdResolver(@NotNull Function<org.bukkit.inventory.ItemStack, net.kyori.adventure.key.Key> resolver) How an item stack's id is found; the CraftEngine integration reports custom ids (E10).static voidsetItemFactory(@NotNull Function<net.kyori.adventure.key.Key, org.bukkit.inventory.ItemStack> factory) How an item is built from its id; the CraftEngine integration builds custom items.static @Nullable org.bukkit.inventory.ItemStacktoItemStack(@NotNull ResourceVariant variant, int amount) static @NotNull List<org.bukkit.inventory.ItemStack> toItemStacks(@NotNull ResourceStack stack) Splits an item resource into stacks no larger than the item's max stack size.static @NotNull ResourceStacktoResource(@NotNull org.bukkit.inventory.ItemStack stack) static @NotNull ResourceStacktoResource(@NotNull org.bukkit.inventory.ItemStack stack, @Nullable net.kyori.adventure.key.Key itemId)
-
Method Details
-
setIdResolver
@Internal public static void setIdResolver(@NotNull @NotNull Function<org.bukkit.inventory.ItemStack, net.kyori.adventure.key.Key> resolver) How an item stack's id is found; the CraftEngine integration reports custom ids (E10). -
setItemFactory
@Internal public static void setItemFactory(@NotNull @NotNull Function<net.kyori.adventure.key.Key, org.bukkit.inventory.ItemStack> factory) How an item is built from its id; the CraftEngine integration builds custom items. -
itemOf
@Nullable public static @Nullable org.bukkit.inventory.ItemStack itemOf(@NotNull @NotNull net.kyori.adventure.key.Key id) One item with this id (CraftEngine or vanilla), ornullif there is none. -
idOf
@NotNull public static @NotNull net.kyori.adventure.key.Key idOf(@NotNull @NotNull org.bukkit.inventory.ItemStack stack) The item's id: a CraftEngine custom id for CraftEngine items, else the material key. -
toResource
@NotNull public static @NotNull ResourceStack toResource(@NotNull @NotNull org.bukkit.inventory.ItemStack stack, @Nullable @Nullable net.kyori.adventure.key.Key itemId) - Parameters:
itemId- the item's id; pass a CraftEngine id for CraftEngine items, otherwise the material key is used
-
toResource
@NotNull public static @NotNull ResourceStack toResource(@NotNull @NotNull org.bukkit.inventory.ItemStack stack) -
toItemStack
@Nullable public static @Nullable org.bukkit.inventory.ItemStack toItemStack(@NotNull @NotNull ResourceVariant variant, int amount) - Returns:
nullif the variant is not an item
-
toItemStacks
@NotNull public static @NotNull List<org.bukkit.inventory.ItemStack> toItemStacks(@NotNull @NotNull ResourceStack stack) Splits an item resource into stacks no larger than the item's max stack size. -
drop
@NotNull public static @NotNull List<ResourceStack> drop(@NotNull @NotNull org.bukkit.World world, int x, int y, int z, @NotNull @NotNull List<ResourceStack> resources) Drops the item resources amongresourcesat the block's position (owner thread).- Returns:
- the resources that have no item form and were not dropped
-