Eigencraft crashing when Redstone placed in certain configuration
Stack trace
[15:54:07 ERROR]: Command exception: /fill -38 71 -43 -32 71 -36 minecraft:redstone_wire[power=14, east=up]
java.lang.NullPointerException: Cannot read field "currentState" because "center_up" is null
at com.destroystokyo.paper.util.RedstoneWireTurbo.calculateCurrentChanges(RedstoneWireTurbo.java:861) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at com.destroystokyo.paper.util.RedstoneWireTurbo.updateNode(RedstoneWireTurbo.java:444) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at com.destroystokyo.paper.util.RedstoneWireTurbo.breadthFirstWalk(RedstoneWireTurbo.java:638) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at com.destroystokyo.paper.util.RedstoneWireTurbo.updateSurroundingRedstone(RedstoneWireTurbo.java:807) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.block.RedStoneWireBlock.updateSurroundingRedstone(RedStoneWireBlock.java:272) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.block.RedStoneWireBlock.onPlace(RedStoneWireBlock.java:467) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.block.state.BlockBehaviour.onPlace(BlockBehaviour.java:164) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.onPlace(BlockBehaviour.java:1209) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.onPlace(BlockBehaviour.java:1205) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.chunk.LevelChunk.setBlockState(LevelChunk.java:406) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.Level.setBlock(Level.java:1051) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.world.level.Level.setBlock(Level.java:1012) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.arguments.blocks.BlockInput.place(BlockInput.java:67) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.commands.FillCommand.fillBlocks(FillCommand.java:172) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.commands.FillCommand.lambda$register$2(FillCommand.java:49) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at com.mojang.brigadier.context.ContextChain.runExecutable(ContextChain.java:73) ~[brigadier-1.3.10.jar:?]
at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:31) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.execution.tasks.ExecuteCommand.execute(ExecuteCommand.java:19) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.execution.UnboundEntryAction.lambda$bind$0(UnboundEntryAction.java:8) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.execution.CommandQueueEntry.execute(CommandQueueEntry.java:5) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.execution.ExecutionContext.runCommandQueue(ExecutionContext.java:103) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.Commands.executeCommandInContext(Commands.java:443) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.Commands.performCommand(Commands.java:350) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.Commands.performCommand(Commands.java:337) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.commands.Commands.performCommand(Commands.java:332) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.network.ServerGamePacketListenerImpl.performUnsignedChatCommand(ServerGamePacketListenerImpl.java:2218) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.network.ServerGamePacketListenerImpl.lambda$handleChatCommand$11(ServerGamePacketListenerImpl.java:2192) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.TickTask.run(TickTask.java:18) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.util.thread.BlockableEventLoop.doRunTask(BlockableEventLoop.java:151) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.util.thread.ReentrantBlockableEventLoop.doRunTask(ReentrantBlockableEventLoop.java:24) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:1537) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.doRunTask(MinecraftServer.java:201) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.util.thread.BlockableEventLoop.pollTask(BlockableEventLoop.java:125) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.pollTaskInternal(MinecraftServer.java:1514) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.pollTask(MinecraftServer.java:1507) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.util.thread.BlockableEventLoop.managedBlock(BlockableEventLoop.java:135) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.managedBlock(MinecraftServer.java:1466) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.waitUntilNextTick(MinecraftServer.java:1473) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer.java:1318) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at net.minecraft.server.MinecraftServer.lambda$spin$0(MinecraftServer.java:330) ~[paper-1.21.1.jar:1.21.1-57-b483da4]
at java.base/java.lang.Thread.run(Thread.java:1583) ~[?:?]
Plugin and Datapack List
None
Actions to reproduce (if known)
The bug seems to occur with multiple different Redstone configurations. So far, I've only been able to identify one reproducible method. The issue can occur when using world edit with Redstone, but I was able to replicate the issue using the vanilla /fill command without any additional plugins installed.
- Build a flat grid of Redstone dust. Ensure that the Redstone is powered on, such as with a lever on any part of the grid.
- Using the /fill command, fill the area above the Redstone grid with more Redstone. It seems to help if you purposefully set the Redstone to have some different alignment. For example, using
/fill -38 71 -43 -32 71 -36 minecraft:redstone_wire[power=14, east=up]seemed to produce the error, while just usingminecraft:redstone_wireeither never caused the error, or was much less likely to. I want to stress that it's possible to still cause the crash without doing this, just much less likely. - The error will be thrown to the console, and while the server will not crash, any Redstone contraptions will stop working, as Redstone signals won't be able to travel more than one block.
A diagram to try and demonstrate this visually:
In the above diagram, the orange layer represents the layer of Redstone being placed using //fill above the original grid. The pasted layer will usually completely destroy itself after undergoing block updates.
Paper version
This server is running Paper version 1.21.1-77-master@4ff58c4 (2024-09-12T18:05:09Z) (Implementing API version 1.21.1-R0.1-SNAPSHOT)
Other
The issue seems to be location dependant. Using a grid of size 10 x 10, the chances of encountering this issue seem to be almost 100%. However, working with smaller grids, the location of the Redstone being //filled seems to have an effect on whether the error will get thrown.
This is only an issue with Eigencraft. Both the vanilla implementation and Alternate Current did not have this issue when testing.
In testing, it's important that either the grid being pasted, or the grid already in-place, is powered on. It may be possible to replicate this crash without the Redstone dust being powered on, but I wasn't able to.
I haven't been able to find a way to replicate the issue without using world edit's //fill command, or the vanilla /fill command. The issue does occur for other commands, such as /setblock, or /clone. It may be possible to create the required "invalid" Redstone configuration using pistons, or another Redstone contraption, but I've not been able to identify any potential candidates.
The issue does not crash the entire server, but rather it only crashes Redstone. After the error gets thrown, all Redstone on the server will cease to function until the server is restarted.
A grid is not required to reproduce this error. In testing, I was able to "crash" Redstone even when pasting regular contraptions. However, due to the issue being location-dependant, using a grid seems to be the best way to reproduce this issue. The error thrown to the console was more or less the same when pasting contraptions instead.
Are you still able to reproduce this on 1.21.10? I attempted to reproduce this using the same coordinates as in the reproduction steps (blocks on y=69, powered redstone dust on y=70, fill on y=71) and could not observe any stacktrace in console. The filled redstone did cause neighbour updates for the redstone below it, but the lower redstone exits early before ever reaching the part in the stacktrace.
Are you still able to reproduce this on 1.21.10? I attempted to reproduce this using the same coordinates as in the reproduction steps (blocks on y=69, powered redstone dust on y=70, fill on y=71) and could not observe any stacktrace in console. The filled redstone did cause neighbour updates for the redstone below it, but the lower redstone exits early before ever reaching the part in the stacktrace.
Hi @Warriorrrr you're right. I've not had a chance to test this since reporting this issue as we switched to Alternate Current. Having just tested on a later version of Paper, I can confirm that this issue is no longer present. Presumably this was (intentionally or unintentionally) fixed at some point without be noticing. I appreciate the reminder.
Going to close this now.
Was able to replicate on .10 again: https://pastes.dev/xl9ORRkZFC