Package org.geysermc.geyser.inventory
Class GeyserItemStack
java.lang.Object
org.geysermc.geyser.inventory.GeyserItemStack
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionvoidadd(int add) org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplayasItem()protected booleancopy()copy(int newAmount) booleanstatic @NonNull GeyserItemStackfrom(@NonNull org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay slotDisplay) static @NonNull GeyserItemStackfrom(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack itemStack) @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentsReturns all components of this item - base and additional components sent over the network.intint<T> @Nullable TgetComponent(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type) Returns the stored data component for a givenDataComponentType, or null.<T> TgetComponentElseGet(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type, Supplier<T> supplier) @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentsintorg.cloudburstmc.protocol.bedrock.data.inventory.ItemDatagetItemData(GeyserSession session) org.geysermc.mcprotocollib.protocol.data.game.item.ItemStack@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.ItemStackgetItemStack(int newAmount) intgetMapping(GeyserSession session) intintintgetNetId()@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentsinthashCode()booleanbooleanbooleanis(GeyserSession session, Tag<Item> tag) booleanis(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet set) booleanbooleanbooleanisEmpty()booleanisSameItem(GeyserItemStack other) voidmergeBundleData(GeyserSession session, BundleCache.BundleData oldBundleData) booleanstatic @NonNull GeyserItemStackof(int javaId, int amount) static @NonNull GeyserItemStackof(int javaId, int amount, @Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) voidsetAmount(int amount) voidsetBundleData(BundleCache.BundleData bundleData) voidsetComponents(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) voidsetNetId(int netId) voidsub(int sub) toString()
-
Field Details
-
EMPTY
-
-
Method Details
-
of
-
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() -
is
-
is
-
is
public boolean is(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet set) -
isSameItem
-
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, usegetOrCreateComponents().- 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
DataComponentspatch 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 givenDataComponentType, 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- theDataComponentTypeto 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
-
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
-
getMapping
-
asIngredient
public org.geysermc.mcprotocollib.protocol.data.game.recipe.display.slot.SlotDisplay asIngredient() -
getMaxStackSize
public int getMaxStackSize() -
getMaxDamage
public int getMaxDamage() -
getDamage
public int getDamage() -
nextDamageWillBreak
public boolean nextDamageWillBreak() -
isDamageable
public boolean isDamageable() -
isDamaged
public boolean isDamaged() -
asItem
-
isEmpty
public boolean isEmpty() -
copy
-
copy
-
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
-
equals
-
canEqual
-
hashCode
public int hashCode() -
toString
-