Class GeyserItemStack

java.lang.Object
org.geysermc.geyser.inventory.GeyserItemStack

public class GeyserItemStack extends Object
  • Field Details

  • Method Details

    • of

      public static @NonNull GeyserItemStack of(int javaId, int amount)
    • of

      public static @NonNull GeyserItemStack of(int javaId, int amount, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components)
    • from

      public static @NonNull GeyserItemStack from(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack itemStack)
    • from

      public static @NonNull GeyserItemStack from(@NonNull org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay slotDisplay)
    • getJavaId

      public int getJavaId()
    • getAmount

      public int getAmount()
    • getAllComponents

      public @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents getAllComponents()
      Returns all components of this item - base and additional components sent over the network. These are NOT modifiable! To add components, use getOrCreateComponents().
      Returns:
      the item's base data components and the "additional" ones that may exist.
    • getComponents

      public @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents getComponents()
      Returns:
      the DataComponents patch that's sent over the network.
    • hasNonBaseComponents

      public boolean hasNonBaseComponents()
      Returns:
      whether this GeyserItemStack has any component modifications additional to the base item components.
    • getOrCreateComponents

      public @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents getOrCreateComponents()
    • getComponent

      public <T> @Nullable T getComponent(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type)
      Returns the stored data component for a given DataComponentType, or null.

      This method will first check the additional components that may exist, and fallback to the item's default (or, "base") components if need be.

      Type Parameters:
      T - the value's type
      Parameters:
      type - the DataComponentType to query
      Returns:
      the value for said type, or null.
    • getComponentElseGet

      public <T> T getComponentElseGet(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type, Supplier<T> supplier)
    • getNetId

      public int getNetId()
    • getBundleId

      public int getBundleId()
    • mergeBundleData

      public void mergeBundleData(GeyserSession session, BundleCache.BundleData oldBundleData)
    • add

      public void add(int add)
    • sub

      public void sub(int sub)
    • getItemStack

      public org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack getItemStack()
    • getItemStack

      public @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack getItemStack(int newAmount)
    • getItemData

      public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData getItemData(GeyserSession session)
    • getMapping

      public ItemMapping getMapping(GeyserSession session)
    • asSlotDisplay

      public org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay asSlotDisplay()
    • getMaxDamage

      public int getMaxDamage()
    • getDamage

      public int getDamage()
    • nextDamageWillBreak

      public boolean nextDamageWillBreak()
    • isDamageable

      public boolean isDamageable()
    • asItem

      public Item asItem()
    • isEmpty

      public boolean isEmpty()
    • copy

      public GeyserItemStack copy()
    • copy

      public GeyserItemStack copy(int newAmount)
    • getBundleData

      public BundleCache.BundleData getBundleData()
    • setAmount

      public void setAmount(int amount)
    • setComponents

      public void setComponents(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components)
    • setNetId

      public void setNetId(int netId)
    • setBundleData

      public void setBundleData(BundleCache.BundleData bundleData)
    • equals

      public boolean equals(Object o)
      Overrides:
      equals in class Object
    • canEqual

      protected boolean canEqual(Object other)
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object