Advanced Peripherals

Advanced Peripherals

29M Downloads

Player Turtle throws NullPointerException for all methods.

fatboychummy opened this issue ยท 8 comments

commented

Descripe

Playing on Wojbie's CC Playground server, went to use a Player Turtle to detect when a player enters a certain area and dispense an item. However, I quickly noticed that ALL methods on the player detecter were returning a null pointer error.

Relevant log error (ran methods getName() and getPlayersInRange(5) in an offline world):

[17:26:33] [ComputerCraft-Coroutine-0/ERROR] [computercraft/]: Error calling call on dan200.computercraft.core.apis.PeripheralAPI@7ce4042
java.lang.NullPointerException: null
	at de.srendi.advancedperipherals.common.addons.computercraft.base.BasePeripheral.getName(BasePeripheral.java:85) ~[advancedperipherals:0.6.7b] {re:classloading}
	at de.srendi.advancedperipherals.common.addons.computercraft.base.BasePeripheral$cc$getName87.apply(CC generated method) ~[?:?] {re:classloading,re:classloading}
	at dan200.computercraft.core.apis.PeripheralAPI$PeripheralWrapper.call(PeripheralAPI.java:105) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.apis.PeripheralAPI.call(PeripheralAPI.java:338) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.apis.PeripheralAPI$cc$call54.apply(CC generated method) ~[?:?] {re:classloading,re:classloading}
	at dan200.computercraft.core.lua.ResultInterpreterFunction.invoke(ResultInterpreterFunction.java:58) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.ResumableVarArgFunction.invoke(ResumableVarArgFunction.java:77) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.LuaInterpreter.execute(LuaInterpreter.java:491) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.LuaInterpretedFunction.invoke(LuaInterpretedFunction.java:149) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.OperationHelper.invoke(OperationHelper.java:486) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.OperationHelper.invoke(OperationHelper.java:481) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.lib.BaseLib.pcall(BaseLib.java:436) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.lib.BaseLib.access$500(BaseLib.java:59) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.lib.BaseLib$BaseLibR.invoke(BaseLib.java:334) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.ResumableVarArgFunction.invoke(ResumableVarArgFunction.java:77) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.OperationHelper.invoke(OperationHelper.java:486) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.LuaInterpreter.execute(LuaInterpreter.java:403) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.function.LuaInterpretedFunction.resume(LuaInterpretedFunction.java:196) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.debug.DebugFrame.resume(DebugFrame.java:243) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.LuaThread.loop(LuaThread.java:566) ~[computercraft:1.97.0] {re:classloading}
	at org.squiddev.cobalt.LuaThread$1.run(LuaThread.java:463) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.lua.CobaltLuaMachine.lambda$null$1(CobaltLuaMachine.java:79) ~[computercraft:1.97.0] {re:classloading}
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) [?:1.8.0_191] {}
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624) [?:1.8.0_191] {}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191] {}
[17:26:43] [Server thread/ERROR] [computercraft/]: Error running task
java.lang.NullPointerException: null
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.PlayerDetectorPeripheral.isInRange(PlayerDetectorPeripheral.java:101) ~[advancedperipherals:0.6.7b] {re:classloading}
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.PlayerDetectorPeripheral.getPlayersInRange(PlayerDetectorPeripheral.java:45) ~[advancedperipherals:0.6.7b] {re:classloading}
	at de.srendi.advancedperipherals.common.addons.computercraft.peripheral.PlayerDetectorPeripheral$cc$getPlayersInRange83.apply(CC generated method) ~[?:?] {re:classloading,re:classloading}
	at dan200.computercraft.core.asm.PeripheralMethod.lambda$null$0(PeripheralMethod.java:21) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.lua.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:34) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.computer.MainThreadExecutor.execute(MainThreadExecutor.java:143) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.core.computer.MainThread.executePendingTasks(MainThread.java:157) ~[computercraft:1.97.0] {re:classloading}
	at dan200.computercraft.shared.CommonHooks.onServerTick(CommonHooks.java:58) ~[computercraft:1.97.0] {re:classloading}
	at net.minecraftforge.eventbus.ASMEventHandler_171_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:?] {re:classloading}
	at net.minecraft.server.MinecraftServer.func_71217_p(MinecraftServer.java:785) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.integrated.IntegratedServer.func_71217_p(IntegratedServer.java:78) ~[?:?] {re:classloading,pl:runtimedistcleaner:A}
	at net.minecraft.server.MinecraftServer.func_240802_v_(MinecraftServer.java:642) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at net.minecraft.server.MinecraftServer.func_240783_a_(MinecraftServer.java:232) ~[?:?] {re:classloading,pl:accesstransformer:B}
	at java.lang.Thread.run(Thread.java:748) [?:1.8.0_191] {}

Steps to reproduce

  1. Grab player turtle from creative inventory (or place player detector into turtle inventory and equip it)
  2. Open the lua prompt
  3. Run the following:
lua> p = peripheral.wrap("right") -- or left, if you equipped it on the left.
lua> p.getPlayersInRange(5)
lua:1: Java Exception Thrown: Java.lang.NullPointerException

Version

0.6.7b (Latest)

Minecraft, Forge and maybe other related mods versions

Minecraft 1.16.5, Forge 36.1.32

Screenshots or Videos

No response

Crashlog/log

No response

commented

Fixed in 0.7a

commented

Could you send me a mod list? I can't reproduce this.

commented

Could you send me a mod list? I can't reproduce this.

advancedperipherals-0.6.7b
architectury-1.19.27-forge
cc-tweaked-1.16.5-1.97.0
ftb-chunks-1605.2.3-build.75
ftb-gui-library-1605.2.1.41-forge
morered-1.16.5-2.1.1.0
commented

I should note, SPECIFICALLY the player turtle. The player detector by itself seems to work as expected.

commented

I am pretty sure that this problem was fixed in dev already.

If I will provide dev build, can I ask to retest it in your case?

commented

I could do that, yes.

commented

Try this, please

commented

Tested all methods on the devbuild using a player turtle, they worked!