Crashes in combination with the Create mod
Darkluke1111 opened this issue ยท 3 comments
Hi,
we noticed repeating crashes on our Server (running the Valhesia: Enhanced Vanilla pack) when players use the Create mod to make Schematics that contain Iron Chests.
The Problem seems to be the markDirty method in the GenericChestEntity class which casts a world into a ServerWorld with insufficient checks:
if (this.getWorld() != null && !this.getWorld().isClient()) { ((ServerWorld) world).getChunkManager().markForUpdate(getPos()); }
This crashes the server with a ClassCastException because Create loads the schematic into a SchematicWorld temporarily, which isn't a ServerWorld.
We temporarily fixed it by adding an instanceof-clause into the if-condition but I'm not really into minecraft modding so I'm not sure whether that causes other issues.
Cheers!
Hello,
thank you for your report.
Unfortunately I have never played with Create and recreating the issue would take me a while. Could you please paste here a crash report and the code snipped (in-full) that you have modified? That would help me release a fix soon
Thanks
The idea of adding adding the instanceof clause appears to be the best solution at the moment.
After some testing it does not appear to cause any issues.
I will release the update soon on CourseForge. However, it's up to Valhesia devs to release the modpack with the updated version.
Thank you again for the bug report!
We already threw away the original log but I reproduced it again with a minimal mod setup for you.
Mods installed:
[โ๏ธ] create-mc1.18.2_v0.4.1+637
[โ๏ธ] fabric-api-0.57.0+1.18.2
[โ๏ธ] IronChests-1.7.2
[โ๏ธ] modmenu-3.2.3
[โ๏ธ] notenoughcrashes-4.1.6+1.18.2-fabric
Steps to reproduce:
- Place any chest from IronChests
- Create a schematic with the "Schematic and Quill" item that contains this chest
- Copy this schematic at the Schematic Table
- Try to place the schematic with the Schematicannon
- The server crashes and keeps crashing as soon as the Schematicannon gets loaded again
Deobfuscated Stacktrace:
java.lang.ClassCastException: class com.simibubi.create.content.schematics.SchematicWorld cannot be cast to class net.minecraft.class_3218 (com.simibubi.create.content.schematics.SchematicWorld and net.minecraft.class_3218 are in unnamed module of loader net.fabricmc.loader.impl.launch.knot.KnotClassLoader @d2cc05a)
at Not Enough Crashes deobfuscated stack trace.(1.18.2+build.3)
at io.github.cyberanner.ironchests.blocks.blockentities.GenericChestEntity.markDirty(GenericChestEntity.java:95)
at net.minecraft.structure.Structure.place(Structure:340)
at com.simibubi.create.content.schematics.SchematicPrinter.loadSchematic(SchematicPrinter.java:95)
at com.simibubi.create.content.schematics.block.SchematicannonTileEntity.initializePrinter(SchematicannonTileEntity.java:453)
at com.simibubi.create.content.schematics.block.SchematicannonTileEntity.tickPrinter(SchematicannonTileEntity.java:330)
at com.simibubi.create.content.schematics.block.SchematicannonTileEntity.tick(SchematicannonTileEntity.java:290)
at com.simibubi.create.foundation.tileEntity.SmartTileEntityTicker.tick(SmartTileEntityTicker.java:15)
at net.minecraft.world.chunk.WorldChunk$DirectBlockEntityTickInvoker.tick(WorldChunk:659)
at net.minecraft.world.chunk.WorldChunk$WrappedBlockEntityTickInvoker.tick(WorldChunk:713)
at net.minecraft.world.World.tickBlockEntities(World:475)
at net.minecraft.server.world.ServerWorld.tick(ServerWorld:368)
at net.minecraft.server.MinecraftServer.tickWorlds(MinecraftServer:907)
at net.minecraft.server.MinecraftServer.tick(MinecraftServer:851)
at net.minecraft.server.integrated.IntegratedServer.tick(IntegratedServer:97)
at net.minecraft.server.MinecraftServer.runServer(MinecraftServer:697)
at net.minecraft.server.MinecraftServer.method_29739(MinecraftServer:273)
at java.lang.Thread.run(Thread.java:833)
Code that causes the crash:
Hope that helps