Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature]add the nbt attr of ItemStack #97

Open
ye111566 opened this issue Nov 29, 2024 · 4 comments
Open

[feature]add the nbt attr of ItemStack #97

ye111566 opened this issue Nov 29, 2024 · 4 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@ye111566
Copy link

as the title

@ye111566 ye111566 added the enhancement New feature or request label Nov 29, 2024
@ye111566
Copy link
Author

I put an enchanted_book in the first slot of slot.hotbar.
I use the"print(str(self.server.get_player(sender.name).inventory.get_item(0)))"
and the console returns:
ItemStack(minecraft:enchanted_book x 1)
whitout any nbt.
but when I use"self.server.get_player(sender.name).inventory.add_item(self.server.get_player(sender.name).inventory.get_item(0))"
I find that the enchanted_book is successfully copied with nbt.
WHERE WAS THE NBT STORAGED?

@ye111566
Copy link
Author

e0e3364c16445fc75fa7fa917780cb70
935ec9e63b38d07fe5c684254833e74a

@wu-vincent wu-vincent self-assigned this Dec 24, 2024
@wu-vincent wu-vincent added this to the v0.5.8 milestone Dec 24, 2024
@wu-vincent
Copy link
Member

The NBT data is stored internally within the handle to the ItemStack hence it is preserved during operations like copying. However, currently, there is no way to directly access or modify the NBT data.

I am planning to introduce a (very basic) NBT API in the next version which will allow you to interact with the NBT data of ItemStack objects directly.

@Atrium4641
Copy link

The NBT data is stored internally within the handle to the ItemStack hence it is preserved during operations like copying. However, currently, there is no way to directly access or modify the NBT data.

I am planning to introduce a (very basic) NBT API in the next version which will allow you to interact with the NBT data of ItemStack objects directly.

There are also player nbt, physical nbt, creature nbt, block nbt

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants