CC: Tweaked

CC: Tweaked

42M Downloads

Server crashed upon calling `commands.getBlockInfo`

Cheatoid opened this issue · 3 comments

commented

Minecraft Version

1.18.1

Version

1.100.2

Forge Version

39.0.75

Details

Steps to reproduce

Assuming Command computer is enabled and can be used.

  1. Place a Command computer anywhere (I have placed it near spawn in overworld dimension).
  2. Access Command computer's terminal.
    1. Enter lua to open Lua interactive shell.
    2. Copy/paste/run the following piece of code:
      commands.getBlockInfo(commands.getBlockPosition())

As soon as you run that command, the server will crash/close and therefore all players will also be kicked from the server. Also tested in singleplayer, crashed as well.

Server log (click to expand)

Seems like exception in server tick loop...

[Server thread/ERROR]: Exception caught during firing event: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.BlockEntity.save(net.minecraft.nbt.CompoundTag)'
        Index: 3
        Listeners:
                0: NORMAL
                1: ASM: class dan200.computercraft.shared.peripheral.monitor.MonitorWatcher onTick(Lnet/minecraftforge/event/TickEvent$ServerTickEvent;)V
                2: ASM: class dan200.computercraft.shared.util.TickScheduler tick(Lnet/minecraftforge/event/TickEvent$ServerTickEvent;)V
                3: ASM: class dan200.computercraft.shared.CommonHooks onServerTick(Lnet/minecraftforge/event/TickEvent$ServerTickEvent;)V
                4: ASM: net.minecraftforge.common.ForgeInternalHandler@3f642d62 onServerTick(Lnet/minecraftforge/event/TickEvent$ServerTickEvent;)V
java.lang.NoSuchMethodError: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.BlockEntity.save(net.minecraft.nbt.CompoundTag)'
        at TRANSFORMER/[email protected]/dan200.computercraft.shared.computer.apis.CommandAPI.getBlockInfo(CommandAPI.java:84)
        at TRANSFORMER/[email protected]/dan200.computercraft.shared.computer.apis.CommandAPI.getBlockInfo(CommandAPI.java:268)
        at dan200.computercraft.shared.computer.apis.CommandAPI$cc$getBlockInfo112.apply(CC generated method)
        at TRANSFORMER/[email protected]/dan200.computercraft.core.asm.LuaMethod.lambda$static$0(LuaMethod.java:16)
        at TRANSFORMER/[email protected]/dan200.computercraft.core.lua.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:34)
        at TRANSFORMER/[email protected]/dan200.computercraft.core.computer.MainThreadExecutor.execute(MainThreadExecutor.java:143)
        at TRANSFORMER/[email protected]/dan200.computercraft.core.computer.MainThread.executePendingTasks(MainThread.java:157)
        at TRANSFORMER/[email protected]/dan200.computercraft.shared.CommonHooks.onServerTick(CommonHooks.java:60)
        at net.minecraftforge.eventbus.ASMEventHandler_23_CommonHooks_onServerTick_ServerTickEvent.invoke(.dynamic)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:302)
        at MC-BOOTSTRAP/[email protected]/net.minecraftforge.eventbus.EventBus.post(EventBus.java:283)
        at TRANSFORMER/[email protected]/net.minecraftforge.event.ForgeEventFactory.onPreServerTick(ForgeEventFactory.java:881)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668)
        at TRANSFORMER/[email protected]/net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258)
        at java.base/java.lang.Thread.run(Thread.java:833)

[Server thread/ERROR]: Encountered an unexpected exception
java.lang.NoSuchMethodError: 'net.minecraft.nbt.CompoundTag net.minecraft.world.level.block.entity.BlockEntity.save(net.minecraft.nbt.CompoundTag)'
        at dan200.computercraft.shared.computer.apis.CommandAPI.getBlockInfo(CommandAPI.java:84) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.shared.computer.apis.CommandAPI.getBlockInfo(CommandAPI.java:268) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.shared.computer.apis.CommandAPI$cc$getBlockInfo112.apply(CC generated method) ~[?:?]
        at dan200.computercraft.core.asm.LuaMethod.lambda$static$0(LuaMethod.java:16) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.core.lua.LuaContext.lambda$issueMainThreadTask$0(LuaContext.java:34) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.core.computer.MainThreadExecutor.execute(MainThreadExecutor.java:143) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.core.computer.MainThread.executePendingTasks(MainThread.java:157) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at dan200.computercraft.shared.CommonHooks.onServerTick(CommonHooks.java:60) ~[cc-tweaked-1.18.1-1.100.2.jar%2337!/:1.100.2]
        at net.minecraftforge.eventbus.ASMEventHandler_23_CommonHooks_onServerTick_ServerTickEvent.invoke(.dynamic) ~[?:?]
        at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:85) ~[eventbus-5.0.3.jar%232!/:?]
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:302) ~[eventbus-5.0.3.jar%232!/:?]
        at net.minecraftforge.eventbus.EventBus.post(EventBus.java:283) ~[eventbus-5.0.3.jar%232!/:?]
        at net.minecraftforge.event.ForgeEventFactory.onPreServerTick(ForgeEventFactory.java:881) ~[forge-1.18.1-39.0.75-universal.jar%2343!/:?]
        at net.minecraft.server.MinecraftServer.m_5705_(MinecraftServer.java:806) ~[server-1.18.1-20211210.034407-srg.jar%2339!/:?]
        at net.minecraft.server.MinecraftServer.m_130011_(MinecraftServer.java:668) ~[server-1.18.1-20211210.034407-srg.jar%2339!/:?]
        at net.minecraft.server.MinecraftServer.m_177918_(MinecraftServer.java:258) ~[server-1.18.1-20211210.034407-srg.jar%2339!/:?]
        at java.lang.Thread.run(Thread.java:833) [?:?]
commented

Temporarily fixed by downgrading Forge to version 39.0.0 (on client and server), so the above code does not crash the server for now.
Forge 1.18 is still in beta ¯¯\_(ツ)_/¯¯

commented

Probably caused by MinecraftForge/MinecraftForge@75408c1. 39.0.44 or before should be safe to use, though we should probably fix this.

commented

Fixed in 6735cfd.