Package org.geysermc.geyser.item.type
Class Item
java.lang.Object
org.geysermc.geyser.item.type.Item
- Direct Known Subclasses:
ArmorItem,ArrowItem,AxolotlBucketItem,BlockItem,BoatItem,CompassItem,CrossbowItem,DyeItem,EnchantedBookItem,FireworkRocketItem,FireworkStarItem,FishingRodItem,GoatHornItem,MapItem,OminousBottleItem,PotionItem,ShieldItem,SpawnEggItem,TropicalFishBucketItem,WolfArmorItem,WritableBookItem,WrittenBookItem
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Item.Builderbuilder()static @NonNull Itemintintint@NonNull @UnmodifiableView org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentsgatherComponents(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents others) Returns an unmodifiableDataComponentsview containing known data components.<T> @Nullable TgetComponent(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type) Returns this items value (or null) for a specificDataComponentType.booleanOverride if the Bedrock equivalent of an item uses damage for extra data, and should not be tracked when translating an item.booleanis(GeyserSession session, Tag<Item> tag) booleanis(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet set) intjavaId()net.kyori.adventure.key.KeyjavaKey()newItemStack(int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) protected static voidregisterBlock(Block block, Item item) protected final @Nullable org.cloudburstmc.nbt.NbtMapremapEnchantment(GeyserSession session, int enchantId, int level, BedrockItemBuilder builder) voidsetJavaId(int javaId) toBedrockDefinition(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMappings mappings) toString()voidtranslateComponentsToBedrock(@NonNull GeyserSession session, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, @NonNull TooltipOptions tooltip, @NonNull BedrockItemBuilder builder) Takes components from Java Edition and map them into Bedrock.protected final voidtranslateDyedColor(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, BedrockItemBuilder builder) voidtranslateNbtToJava(@NonNull GeyserSession session, @NonNull org.cloudburstmc.nbt.NbtMap bedrockTag, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, @NonNull ItemMapping mapping) Takes NBT from Bedrock Edition and converts any value that Java parses differently.org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.BuildertranslateToBedrock(GeyserSession session, int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping, ItemMappings mappings) @NonNull GeyserItemStacktranslateToJava(GeyserSession session, @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData itemData, @NonNull ItemMapping mapping, @NonNull ItemMappings mappings)
-
Field Details
-
javaIdentifier
protected final net.kyori.adventure.key.Key javaIdentifier
-
-
Constructor Details
-
Item
-
-
Method Details
-
javaIdentifier
-
javaKey
public net.kyori.adventure.key.Key javaKey() -
javaId
public int javaId() -
defaultMaxDamage
public int defaultMaxDamage() -
defaultAttackDamage
public int defaultAttackDamage() -
defaultMaxStackSize
public int defaultMaxStackSize() -
is
-
is
public boolean is(GeyserSession session, org.geysermc.mcprotocollib.protocol.data.game.item.component.HolderSet set) -
gatherComponents
public @NonNull @UnmodifiableView org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents gatherComponents(@Nullable org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents others) Returns an unmodifiableDataComponentsview containing known data components. Optionally, additional components can be provided to replace (or add to) the items' base components. To add data components, useGeyserItemStack.getOrCreateComponents(). -
getComponent
public <T> @Nullable T getComponent(@NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponentType<T> type) Returns this items value (or null) for a specificDataComponentType. Prefer usingGeyserItemStack.getComponent(DataComponentType)to also query additional components that would override the default ones. -
translationKey
-
translateToBedrock
public org.cloudburstmc.protocol.bedrock.data.inventory.ItemData.Builder translateToBedrock(GeyserSession session, int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMapping mapping, ItemMappings mappings) -
translateToJava
public @NonNull GeyserItemStack translateToJava(GeyserSession session, @NonNull org.cloudburstmc.protocol.bedrock.data.inventory.ItemData itemData, @NonNull ItemMapping mapping, @NonNull ItemMappings mappings) -
toBedrockDefinition
public ItemMapping toBedrockDefinition(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, ItemMappings mappings) -
translateComponentsToBedrock
public void translateComponentsToBedrock(@NonNull GeyserSession session, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, @NonNull TooltipOptions tooltip, @NonNull BedrockItemBuilder builder) Takes components from Java Edition and map them into Bedrock. -
translateNbtToJava
public void translateNbtToJava(@NonNull GeyserSession session, @NonNull org.cloudburstmc.nbt.NbtMap bedrockTag, @NonNull org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, @NonNull ItemMapping mapping) Takes NBT from Bedrock Edition and converts any value that Java parses differently.
Do note that this method is, these days, only called in three places (as of 2023/~1.19):- Extra recipe loading
- Creative menu
- Stonecutters
-
remapEnchantment
protected final @Nullable org.cloudburstmc.nbt.NbtMap remapEnchantment(GeyserSession session, int enchantId, int level, BedrockItemBuilder builder) -
translateDyedColor
protected final void translateDyedColor(org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components, BedrockItemBuilder builder) -
ignoreDamage
public boolean ignoreDamage()Override if the Bedrock equivalent of an item uses damage for extra data, and should not be tracked when translating an item. -
newItemStack
public GeyserItemStack newItemStack(int count, org.geysermc.mcprotocollib.protocol.data.game.item.component.DataComponents components) -
setJavaId
public void setJavaId(int javaId) -
toString
-
byBlock
- Returns:
- the block associated with this item, or air if nothing
-
registerBlock
-
builder
-