Advanced Peripherals

Advanced Peripherals

29M Downloads

ME Bridge removes NBT data

LelouBil opened this issue ยท 3 comments

commented

Describe

Imported items using importItem(table item, string direction) from the ME Bridge lose their NBT data

Discovered in All The Mods 8 v1.0.8 and not reproduced in isolation, the linked video is also using ATM 8-1.0.8
UPDATE: I have reproduced it only with CC-Tweaked, AE2 and Advanced Peripherals, all using the same versions I linked below

Steps to reproduce

  1. Place down a ME Network (with storage)
  2. Place down a computer and an ME Bridge connected to the ME Network
  3. Place a chest next to the ME Bridge
  4. Use the provided program to transfer an item (with NBT data) from the chest into the ME Network (adjust chest side and item name)
local bridge = peripheral.wrap("meBridge")
local bside = "west" --adjust

bridge.importItem({name="minecraft:enchanted_book"},bside)
print(textutils.serialiseJSON(bridge.listItems[1].nbt)
  1. Look inside the ME Network from any other mean and extract the item
  2. The item lost it's NBT data.

Multiplayer?

Yes

Version

1.19.2-0.7.22b (Latest 1.19)

Minecraft, Forge and maybe other related mods versions

MC 1.19.2, Modpack : All The Mods 8 v1.0.8, Forge : 43.2.3, AE2: 12.9.2, CC-Tweaked: 1.101.1

Screenshots or Videos

https://i.imgur.com/bWCdsr1.mp4

Crashlog/log

No response

commented

I tracked down the bug to here
https://github.com/SirEndii/AdvancedPeripherals/blob/dbb9c4377b7528d12c294555ee0e212efc7b819e/src/main/java/de/srendi/advancedperipherals/common/addons/computercraft/peripheral/MeBridgePeripheral.java#L147-L150

To create the AEItemKey, the itemstack data of the provided filter is used, not the one of the actually found item in the inventory.

In my case, I didn't have any nbt tag in the filter, so the nbt was just blank.

This can be fixed by creating a AEItemKey for each stack actually transferred.

If I had json nbt in the filter, it would get applied to the items that matched (no problem here)
And if I had nbt as a hash, it would look into ae2 in order to get the full nbt data to create the AEItemKey, but if the network doesn't have any it would just return null
https://github.com/SirEndii/AdvancedPeripherals/blob/dbb9c4377b7528d12c294555ee0e212efc7b819e/src/main/java/de/srendi/advancedperipherals/common/util/ItemUtil.java#LL99C36-L99C36
Thats not what's happening here, but this can cause nbt loss too.

commented

The whole item transferring stuff in AP is old garbage which I need to improve in 0.8

But thank you for your contribution

commented

Currently working on refining that!
Every item transferring related block now uses the same system.
Adding new filters and eliminating bugs.

This is the video I posted on discord

2023-02-04_03-17-47.mp4