hibiii / Windchimes

A lightweight mod to add swaying, chiming wind chimes for Minecraft
The Unlicense
9 stars 8 forks source link

Crash Loop when disassembled from Create Contraption #11

Closed Talia-12 closed 1 year ago

Talia-12 commented 1 year ago

When a wind-chime is part of a contraption and that contraption is disassembled back into blocks it crashes the world, and continues to do so whenever the world is loaded; I think that is a result of this method

@Override
public boolean onSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data) {
    return world.getBlockEntity(pos).onSyncedBlockEvent(type, data);
}

with getBlockEntity returning null and attempting to call onSyncedBlockEvent on the null object causing the exception. Not sure why the block entity isn't present in the world properly though, especially after the first crash.

https://mclo.gs/TRl9EBW

Talia-12 commented 1 year ago

my suggestion would be adding a null-check there

object-Object commented 1 year ago

To reproduce, put a windchime on a minecart assembler, assemble it, then disassemble it. Assembling works fine, but disassembly causes a ticking entity crash, which effectively softlocks the world because it continues crashing when the chunks are loaded.

Versions:

Minecraft: 1.19.2 Quilt Loader: 0.18.10 QFAPI: 4.0.0-beta.30_qsl-3.0.0-beta.29_fapi-0.76.0 Windchimes: 1.2.1 (We also have a bunch of other mods, it's a custom modpack: https://github.com/HexxyCraft/modpack)

Logs:

Server: https://mclo.gs/Sph488x Singleplayer: https://mclo.gs/TRl9EBW

object-Object commented 1 year ago

The crash only occurs with some types of contraptions (including minecart assemblers). Windmills apparently don't crash, but behave very weirdly: https://cdn.discordapp.com/attachments/1101506920268963871/1133030068915032154/Does_Not_Like.mp4

Rotating bearings crash: https://cdn.discordapp.com/attachments/1101506920268963871/1133031785333276793/Does_Not_Like_2.mp4

hibiii commented 1 year ago

i mean... i wrote the code against vanilla, and vanilla doesn't remove block entities without removing the block...

on it

object-Object commented 1 year ago

@hibiii Sorry to bug you again, but is this patch available for 1.19.2 or do we need to fork and backport it for our modpack? (I'm fine with doing that, there'd just be no point if you're planning to release it officially.)

hibiii commented 1 year ago

you could apply d9d0091d9b6b8fff3182c6d279e217c8b190e7cd's diff onto v1.2.1 and compile locally