MightyPirates / OpenComputers

Home of the OpenComputers mod for Minecraft.
https://oc.cil.li
Other
1.59k stars 430 forks source link

[1.12.2] [AE2 Integration] Unable to use a filter table with an enchantments key #2961

Closed linuxdaemon closed 6 years ago

linuxdaemon commented 6 years ago

What happens

nil "unknown error" when retrieving a list of items from the AE network with getItemsInNetwork(). This seems to only occur with a filter table containing a list of enchantments, for example:

local filter = {
  name = "minecraft:diamond_sword",
  enchantments = {
    {
      label="Reaper V",
      level=5,
      name="enchantment.draconicevolution.reaperEnchant",
    },
    n=1
  }
}
local component = require("component")
local items, err = component.me_controller.getItemsInNetwork(filter)
-- items = nil
-- err = "unknown error"

This seems to only occur if there is another item in the AE system.

How to replicate

  1. Acquire computer (tested with a creative computer with tier 3 gpu, 2x3.5 mem, openos floppy, creative APU, lua eeprom, tier 3 screen, keyboard)
  2. Construct a basic AE network (tested with a single AE controller connected to a creative energy cell and an ME chest with a 64k storage cell in it)
  3. attach adapter to ME controller and computer
  4. Place 2 diamond swords in the ME chest, one unenchanted, one enchanted.
  5. Boot the computer, ensure the architecture is Lua 5.2 (a whole different set of issues occur on 5.3, possible related to #2448 )\
  6. Enter lua console
  7. Run item=component.me_controller.getItemsInNetwork({name="minecraft:diamond_sword", hasTag=true})[1] to find the enchanted diamond sword
  8. Attempt to find the sword again via =component.me_controller.getItemsInNetwork({name=item.name, enchantments=item.enchantments})

The issue seems to occur with any item with NBT (specifically tested with forestry bees though), replicated via =component.me_controller.getItemsInNetwork(item) where item is the result from the table returned from an earlier getItemsInNetwork() call, which has NBT.

Forestry bees and enchanted items do seem to have another thing in common, they both have tables as values in the filter table, individual and enchantments respectively, so this may be the issue.

Logs

This does produce a stack trace in the log: https://paste.ee/p/cbltx (last 45 lines or so)

Versions

Minecraft: 1.12.2 Forge: 14.23.4.2760 OpenComputers: 1.7.2.67 AE2: rv5-stable-11

payonel commented 6 years ago

please retest with our dev builds. we've made many fixes with our ae2 integration https://ci.cil.li/

linuxdaemon commented 6 years ago

Tested with exact same setup, OC version 1.7.2.116, different error this time. When performing any lookup using getItemsInNetwork() the only result I get is nil, "{damage=0, size=1, hasTag=false, maxDamage=1561, name=minecraft:diamond_sword, maxSize=1, label=Diamond Sword} (of class java.util.HashMap)"

payonel commented 6 years ago

yikes -- ok thanks for the info

linuxdaemon commented 6 years ago

This happens for getCraftables(), store(), etc as well, it seems anything using the filter table against an ItemStack fails, so much of the AE API is unusable

payonel commented 6 years ago

please retry with our latest dev builds

linuxdaemon commented 6 years ago

Yep, works now, thanks :+1: