Advanced Peripherals

Advanced Peripherals

29M Downloads

[Issue] Inventory manager voids items

JJSax opened this issue ยท 1 comments

commented

Describe

Running the following

p = peripheral.wrap("left")
p.removeItemFromPlayer("DOWN", 1, "minecraft:cobblestone")

will take the item from your inventory and give an error. The item is not put anywhere and is just voided once you close the interface.

The error is

Java Exception Thrown:
java.lang.NullPointerException

I know it's likely that I'm putting in a wrong parameter, but I'm glad I tested on cobblestone.

Reproduce

Steps to reproduce the behavior:

  1. Use the code above
  2. Close the interface
  3. Your goodies are gone

...

Versions:

  • Forge version: 36.1.18
  • AdvancedPeripherals version: 0.6.6b

Crashlog/log (Use https://paste.gg or https://pastebin.com to upload your crashlog/log)

[12Jun2021 23:40:23.162] [Server thread/ERROR] [computercraft/]: Error running task
java.lang.NullPointerException: null
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.InventoryManagerPeripheral.insertItem(InventoryManagerPeripheral.java:260) ~[advancedperipherals:0.6.5b]
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.InventoryManagerPeripheral.removeItemFromPlayer(InventoryManagerPeripheral.java:132) ~[advancedperipherals:0.6.5b]
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.InventoryManagerPeripheral$cc$removeItemFromPlayer141.apply(CC generated method) ~[?:?]
	at dan200.computercraft.core.asm.PeripheralMethod.lambda$null$0(PeripheralMethod.java:21) ~[computercraft:1.96.0]
	at dan200.computercraft.core.lua.CobaltLuaMachine$CobaltLuaContext.lambda$issueMainThreadTask$0(CobaltLuaMachine.java:522) ~[computercraft:1.96.0]
	at dan200.computercraft.core.computer.MainThreadExecutor.execute(MainThreadExecutor.java:143) ~[computercraft:1.96.0]
	at dan200.computercraft.core.computer.MainThread.executePendingTasks(MainThread.java:157) ~[computercraft:1.96.0]
	at dan200.computercraft.shared.proxy.ComputerCraftProxyCommon$ForgeHandlers.onServerTick(ComputerCraftProxyCommon.java:138) ~[computercraft:1.96.0]
	at net.minecraftforge.eventbus.ASMEventHandler_267_ForgeHandlers_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]

debug.log
Edit: I believe the important part is near the bottom, at line 11777.

commented

Hi @JJSax,

first of all to resolve your issue in-game: The target inventory for the inventory manager needs to be placed relative to the inventory manager itself, not the computer. In your case below it.

@Seniorendi:
I verified this using the ATM6 Pack with 0.6.6b (same version as above, but it noticed 0.6.6b identifies as 0.6.5b).
Unfortunately it seems like my fix from #88 did not work and #87 wasn't resolved. Do we need to move the nullcheck for the target inventory? Sadly I can't investigate until tomorrow.