RS Bridge - listCraftableItems() throws Java Exception and is unusable
adkinss opened this issue ยท 1 comments
Describe
When calling listCraftableItems(), the following error is displayed on the Computer Terminal:
test.lua:2: Java Exception Thrown: java.lang.IndexOutOfBoundsException: Index: 0, Size 0
The following error is logged on the console:
[09Sep2021 08:37:47.611] [Server thread/ERROR] [computercraft/]: Error running task
java.lang.IndexOutOfBoundsException: Index: 0, Size: 0
at java.util.ArrayList.rangeCheck(ArrayList.java:659) ~[?:1.8.0_292]
at java.util.ArrayList.get(ArrayList.java:435) ~[?:1.8.0_292]
at de.srendi.advancedperipherals.common.addons.refinedstorage.RefinedStorage.listItems(RefinedStorage.java:71) ~[advancedperipherals:0.7.2r]
at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.RsBridgePeripheral.listCraftableItems(RsBridgePeripheral.java:58) ~[advancedperipherals:0.7.2r]
at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.RsBridgePeripheral$cc$listCraftableItems6.apply(CC generated method) ~[?:?]
at dan200.computercraft.core.asm.PeripheralMethod.lambda$null$0(PeripheralMethod.java:21) ~[computercraft:1.98.1]
at dan200.computercraft.core.lua.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:36) ~[computercraft:1.98.1]
at dan200.computercraft.core.computer.MainThreadExecutor.execute(MainThreadExecutor.java:143) ~[computercraft:1.98.1]
at dan200.computercraft.core.computer.MainThread.executePendingTasks(MainThread.java:157) ~[computercraft:1.98.1]
at dan200.computercraft.shared.CommonHooks.onServerTick(CommonHooks.java:59) ~[computercraft:1.98.1]
at net.minecraftforge.eventbus.ASMEventHandler_735_CommonHooks_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?]
at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-4.0.0.jar:?]
at net.minecraftforge.fml.hooks.BasicEventHooks.onPreServerTick(BasicEventHooks.java:115) ~[forge:?]
at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:785) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) ~[?:?]
at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?]
at java.lang.Thread.run(Thread.java:748) [?:1.8.0_292]
Steps to reproduce
The following program demonstrates the error:
local bridge = peripheral.find("rsBridge")
craftables = bridge.listCraftableItems()
Multiplayer?
Yes (local server in house)
Version
0.7.2r (Latest)
Minecraft, Forge and maybe other related mods versions
Mod Pack: Valhelsia 3.4.2a
Minecraft 1.16.5 and Forge 36.2.2
advancedperipherals-1.16.5-0.7.2r.jar (manually updated to this version)
cc-tweaked-1.16.5-1.98.1.jar
refinedstorage-1.9.15.jar
refinedstorageaddons-0.7.3.jar
Screenshots or Videos
No response
Crashlog/log
No response
This ended up not being a show stopper. It may not be exactly the correct way to do it, but I am now calling isItemCrafting()
and craftItem()
on any item in question and looking at the results. If craftItem()
fails, I can assume that there is either no crafting recipe or there isn't enough ingredients in the system to craft the item. Since I have to call both of those functions anyways, I don't see a good reason for me to use listCraftableItems()
, even after it is fixed.