Carpet

Carpet

2M Downloads

destroy function throws NullPointerException with any fortune level

radwadas opened this issue ยท 0 comments

commented

I get NullPointerException when I try to use 'destroy' function with anything else than silk touch.

destroy(block, -1) still works as expected

destroy(block, 0) or any other number throws this:

[08:41:47] [Server thread/ERROR]: Unexpected exception while running Scarpet code
java.lang.NullPointerException: Cannot invoke "net.minecraft.world.World.getServer()" because the return value of "net.minecraft.entity.Entity.method_48926()" is null
at net.minecraft.entity.Entity.getServer(Entity.java:3082) ~[client-intermediary.jar:?]
at xaero.pac.common.server.core.ServerCore.preResourcesDrop(ServerCore.java:845) ~[open-parties-and-claims-fabric-1.20.1-0.22.0.jar:?]
at net.minecraft.block.Block.modify$kjo000$openpartiesandclaims$onDropResourcesPre(Block.java:9176) ~[client-intermediary.jar:?]
at net.minecraft.block.Block.dropStacks(Block.java:352) ~[client-intermediary.jar:?]
at carpet.script.api.WorldAccess.lambda$apply$75(WorldAccess.java:938) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.Expression$17.lazyEval(Expression.java:684) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.Expression.lambda$extractOp$20(Expression.java:1513) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.language.ControlFlow.lambda$apply$2(ControlFlow.java:28) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.Expression$5.lazyEval(Expression.java:364) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.Expression.lambda$extractOp$17(Expression.java:1504) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.value.FunctionValue.execute(FunctionValue.java:271) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetScriptHost.lambda$callUDF$30(CarpetScriptHost.java:906) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.Expression.evalValue(Expression.java:1034) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetScriptHost.callUDF(CarpetScriptHost.java:905) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetScriptHost.callUDF(CarpetScriptHost.java:882) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetEventServer.runEventCall(CarpetEventServer.java:1445) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetEventServer$Callback.execute(CarpetEventServer.java:123) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetEventServer$CallbackList.lambda$call$0(CarpetEventServer.java:279) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.utils.GlocalFlag.runIfEnabled(GlocalFlag.java:67) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetEventServer$CallbackList.call(CarpetEventServer.java:259) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at carpet.script.CarpetEventServer$Event$16.onBlockHit(CarpetEventServer.java:617) ~[fabric-carpet-1.20-1.4.112+v230608.jar:?]
at net.minecraft.server.network.ServerPlayNetworkHandler.handler$dmm000$carpet$onBlockInteracted(ServerPlayNetworkHandler.java:7093) ~[client-intermediary.jar:?]
at net.minecraft.server.network.ServerPlayNetworkHandler.onPlayerInteractBlock(ServerPlayNetworkHandler.java:1140) ~[client-intermediary.jar:?]
at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:34) ~[client-intermediary.jar:?]
at net.minecraft.network.packet.c2s.play.PlayerInteractBlockC2SPacket.apply(PlayerInteractBlockC2SPacket.java:8) ~[client-intermediary.jar:?]
at net.minecraft.network.NetworkThreadUtils.method_11072(NetworkThreadUtils.java:22) ~[client-intermediary.jar:?]
at net.minecraft.server.ServerTask.run(ServerTask.java:18) ~[client-intermediary.jar:?]
at net.minecraft.util.thread.ThreadExecutor.executeTask(ThreadExecutor.java:156) ~[client-intermediary.jar:?]
at net.minecraft.util.thread.ReentrantThreadExecutor.executeTask(ReentrantThreadExecutor.java:23) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:782) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.executeTask(MinecraftServer.java:164) ~[client-intermediary.jar:?]
at net.minecraft.util.thread.ThreadExecutor.runTask(ThreadExecutor.java:130) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.runOneTask(MinecraftServer.java:764) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.runTask(MinecraftServer.java:758) ~[client-intermediary.jar:?]
at net.minecraft.util.thread.ThreadExecutor.runTasks(ThreadExecutor.java:139) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.runTasksTillTickEnd(MinecraftServer.java:743) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.handler$dkl000$carpet$modifiedRunLoop(MinecraftServer.java:22951) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:650) ~[client-intermediary.jar:?]
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer.java:265) ~[client-intermediary.jar:?]
at java.lang.Thread.run(Thread.java:833) ~[?:?]
[08:41:47] [Server thread/INFO]: [Rad_R: Internal error (please report this issue to Carpet) while evaluating: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1937.method_8503()" because the return value of "net.minecraft.class_1297.method_37908()" is null in test at line 4, pos 4]
[08:41:47] [Server thread/INFO]: [Rad_R: if (!(player ~ 'sneaking'), return());]
[08:41:47] [Server thread/INFO]: [Rad_R: HERE>> destroy(block, 0);]
[08:41:47] [Server thread/INFO]: [Rad_R: );]
[08:41:47] [Server thread/INFO]: [Rad_R: Callback failed]
[08:41:47] [Render thread/INFO]: [CHAT] Internal error (please report this issue to Carpet) while evaluating: java.lang.NullPointerException: Cannot invoke "net.minecraft.class_1937.method_8503()" because the return value of "net.minecraft.class_1297.method_37908()" is null in test at line 4, pos 4
[08:41:47] [Render thread/INFO]: [CHAT] if (!(player ~ 'sneaking'), return());
[08:41:47] [Render thread/INFO]: [CHAT] HERE>> destroy(block, 0);
[08:41:47] [Render thread/INFO]: [CHAT] );
[08:41:47] [Render thread/INFO]: [CHAT] Callback failed