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

Using the new inventory handling feature #752

Closed
EchoesNetwork opened this issue Jun 7, 2019 · 12 comments
Closed

Using the new inventory handling feature #752

EchoesNetwork opened this issue Jun 7, 2019 · 12 comments
Labels
a:new-feature Request for a new feature in:inventory-handling Related to Inventory handling resolved The issue has been resolved

Comments

@EchoesNetwork
Copy link

Hi,

I noticed one of the recently closed pull requests implemented inventory handling and I'm excited to write some scripts that make use of it! However, I'm not sure which API documentation is relevant to it. How would I make use of the new inventoryhandling=true feature?

Thanks.

@ORelio
Copy link
Member

ORelio commented Jun 7, 2019

Currently, this is work in progress so there is no API nor commands for it. See #738 and #205.

@xPenguinx
Copy link
Contributor

Right, the inventoryhandling is just something i've started however I reached a barrier with an issue with readNextNbtData not working properly for it thus I'm waiting on if someone can possibly fix it or I somehow find a way to do it.

@ORelio
Copy link
Member

ORelio commented Jun 8, 2019

Do you have any sample of problematic NBT?
I should be able to debug the parsing function since I wrote it and it is pretty well documented.

@xPenguinx
Copy link
Contributor

Do you have any sample of problematic NBT?
I should be able to debug the parsing function since I wrote it and it is pretty well documented.

If you enable the feature and just login to a server maybe do /ah or something or it should even work when you just login with items. I have used the fNBT library to fix it by making it read all the bytes in the cache and then check the size to remove the amount which worked fine but isn't the most efficient way.

@ORelio
Copy link
Member

ORelio commented Jun 9, 2019

Okay. I'll have a look at this. Maybe putting a book or enchanted item in inventory will trigger the issue.

@xPenguinx
Copy link
Contributor

Okay. I'll have a look at this. Maybe putting a book or enchanted item in inventory will trigger the issue.

You might not have to! Looks like it was something else causing the issue. Will be committing soon also was able to handle clientside closewindow

@ORelio
Copy link
Member

ORelio commented Jun 10, 2019

Well, I was expecting the ReadNextNbt() utility to contain bugs as it pretty new, and been tested with 1.14 terrain heightmaps only so it may not work with some other NBT fields 😄

@JovonXandering
Copy link

JovonXandering commented Aug 21, 2019

Well, I was expecting the ReadNextNbt() utility to contain bugs as it pretty new, and been tested with 1.14 terrain heightmaps only so it may not work with some other NBT fields 😄

Hi I am new to this so I might be wrong, but was messing around with the inventory handler stuff, and I think I found the problem with reading NBTs
In the original code, it checked if theres a nbt by doing
if (packetData.ToArray().Count() > 0) { dataTypes.ReadNextNbt(packetData); }
But packetData will contain other data for other slots, so it'll always be true, therefore checking all items for NBT.
so I changed it to
if (packetData.ToArray()[0] != 0) { dataTypes.ReadNextNbt(packetData); } else { dataTypes.ReadNextByte(packetData); //if it doesnt contain NBT, it'll read it to get rid of the byte }
I am not good at programming, so please correct me if I am wrong

@RedByte1337
Copy link

Any updates on this? Can we access the inventory through the client?

@ORelio
Copy link
Member

ORelio commented Sep 26, 2019

Don't have time to work on new features myself, so it entierely depends on contributions. Currently, this has not reached a usable state. Only some data structures are present.

ORelio added a commit that referenced this issue Mar 8, 2020
ReadNextNBT() now returns an empty dictionary if the NBT tag is 0x00
As per https://wiki.vg/Slot_Data 0x00 being a placeholder for "no NBT"
@ORelio
Copy link
Member

ORelio commented Mar 8, 2020

@xPenguinx Hi, for your information a fix for issue #883 seems to match the issue you encountered here, with inventory handling. As per https://wiki.vg/Slot_Data the NBT tag may be replaced by 0x00 (null) when no NBT data is present in the slot. readNextNbtData() will now handle this as a valid (but empty) NBT tag, although it is better to also check for 0x00 when handling the packet.

@ORelio ORelio added a:new-feature Request for a new feature in:inventory-handling Related to Inventory handling resolved The issue has been resolved labels Mar 29, 2020
@ORelio
Copy link
Member

ORelio commented Mar 29, 2020

Inventories are now handled in the newest development build.

@ORelio ORelio closed this as completed Mar 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a:new-feature Request for a new feature in:inventory-handling Related to Inventory handling resolved The issue has been resolved
Projects
None yet
Development

No branches or pull requests

5 participants