Creators-of-Create / Create

[Forge Mod] Building Tools and Aesthetic Technology
MIT License
2.92k stars 907 forks source link

SchematicCannon Killed my World!!! HELP xD (.SchematicWorld cannot be cast to .ServerLevel) #4056

Closed ijescobarj closed 4 months ago

ijescobarj commented 1 year ago

Describe the Bug

first of all, thanks you for taking the time for reading my issue, second, sorry for my terrible kindo self tought english, so im gonna try explain what i got, first ,i load and place the schematics with an steam engine lvl 9 working(amazing btw by me), then, 1 place 4 sophisticated barrels arround canon, Dark iron barrels, then i place the schematics in the cannon, a book, and i got a Crash loop, after that my +1300 survival world ends!

After that, only with oppening the World the games runs into a crash Loop, i only want to recover my map :(

Thanks you all for the help in advance!

https://crashy.net/zUv1Rwn6z01UbI0A3FEf crash-2022-11-26_12.29.28-server.txt

Reproduction Steps

  1. Make an schematic of a Steam Engine lvl 9. 2.Rotate it 180% degrees, and place it in surival.
  2. put 4 dark oak iron barrels arround schematicn cannon
  3. insert the schem on the cannon
  4. insert a book on the cannon
  5. have a fun loop! ...

Expected Result

expeted a list off missing items on the book for the schematic printing. crash-2022-11-26_12.29.28-server.txt

Screenshots and Videos

No response

Crash Report or Log

https://bytebin.lucko.me/6JCT72lsj6

Operating System

Windows 10

Mod Version

0.5.0f

Minecraft Version

1.19.2

Forge Version

43.1.47

Other Mods

notenoughcrashes-4.2.0+1.19.2-forge.jar
Uppers-0.5.1.jar
woodenhopper-1.19-1.3.2.0.jar
sophisticatedcore-1.19.2-0.5.15.142.jar
create_jetpack-2.1.0.jar
IronJetpacks-1.19.2-6.0.1.jar
configurableextramobdrops_1.19.2-2.5.jar
Decoration Mod 1.10 (Ver 1.19.2).jar
Placebo-1.19.2-7.0.1.jar
undeco-1.19-1.3.2.jar
BotanyPotsTiers-Forge-1.19.2-3.1.0.jar
Bookshelf-Forge-1.19.2-16.1.11.jar
sophisticatedbackpacks-1.19.2-3.18.29.719.jar
buildinggadgets-3.16.1-build.15+mc1.19.2.jar
DarkUtilities-Forge-1.19.2-13.1.2.jar
mcw-doors-1.0.7-mc1.19.2.jar
easynetherstar-1.0-1.19-1.19.2.jar
balm-4.5.3.jar
JustEnoughResources-1.19.2-1.1.0.179.jar
cloth-config-8.2.88-forge.jar
paladin-furniture-mod-1.1.1-forge-mc1.19.jar
supplementaries-1.19.2-2.2.20.jar
mob_grinding_utils-1.19.2-0.4.46.jar
konkrete_forge_1.5.3_MC_1.19-1.19.2.jar
easy_piglins-1.19.2-1.0.0.jar
PrettyPipes-1.13.6.jar
corpse-1.19.2-1.0.0.jar
mcw-bridges-2.0.5-mc1.19.2forge.jar
torchmaster-19.2.0.jar
morevillagers-forge-1.19-4.0.3.jar
BotanyTrees-Forge-1.19.2-5.0.1.jar
material_elements_1.19.2-6.0.0.jar
ornamental-1.19.1-4.9.13.jar
mcw-trapdoors-1.0.7-mc1.19.2.jar
mcw-fences-1.0.6-mc1.19.2.jar
supermartijn642corelib-1.0.19a-forge-mc1.19.jar
Jet-Boots-1.19.2-1.2.5.jar
refinedstorage-1.11.1.jar
curios-forge-1.19.2-5.1.1.0.jar
Patchouli-1.19.2-77.jar
blockui-1.19-0.0.64-ALPHA.jar
collective-1.19.2-5.16.jar
FramedBlocks-6.6.1.jar
DrawersTooltip-1.19-forge-6.0.0.jar
BetterThirdPerson-Forge-1.19-1.8.1.jar
Mo' Villagers-1.19.2-1.0.jar
Runelic-Forge-1.19.2-14.1.2.jar
worldedit-mod-7.2.12.jar
mcw-roofs-2.2.1-mc1.19.2-forge.jar
solarenergy-1.19.2-0.5.0.0.jar
cfm-7.0.0-pre34-1.19.jar
architectury-6.3.49-forge.jar
BambooEverything-forge-2.2.4-build.33+mc1.19.2.jar customvillagertrades-forge-19.18.0.jar
mcw-furniture-3.0.2-mc1.19.2.jar
Chimes-1.1.4-1.19.jar
extendedflywheels-1.2.2-1.19.2-0.5.f.jar
FastLeafDecay-30.jar
veinmining-forge-1.0.0-beta.5+1.19.2.jar
mcw-lights-1.0.4-mc1.19.2.jar
bml-1.19-1.1.8.jar
BetterAdvancements-1.19.2-0.2.2.142.jar
easy_mob_farm_1.19.2-4.3.0.jar
QuarkOddities-1.18.jar
Cucumber-1.19.2-6.0.3.jar
Wooden Elytra 1.19.2.jar
sophisticatedstorage-1.19.2-0.5.18.151.jar
additionallanterns-1.0.1a-forge-mc1.19.jar
jei-1.19.2-forge-11.4.0.286.jar
VisualWorkbench-v4.2.0-1.19.2-Forge.jar
goblintraders-1.8.0-1.19.2.jar
CuriosQuarkOBP-1.19.2-1.2.2.jar
createchunkloading-1.3.0-forge.jar
waystones-forge-1.19-11.1.0.jar
journeymap-1.19.1-5.9.0beta2-forge.jar
comforts-forge-6.0.2+1.19.2.jar
framedcompactdrawers-1.19-5.2.0.jar
configured-2.0.1-1.19.2.jar
LibX-1.19.2-4.2.5.jar
Decorative Blocks-forge-1.19.2-3.0.0.jar
BotanyPots-Forge-1.19.2-9.0.13.jar
ddminingdim_1.19.x_1.1.0.jar
CraftTweaker-forge-1.19.2-10.0.16.jar
ExtraDisks-1.19.2-2.2.0.jar
material_elements_decorative_1.19.2-6.0.0.jar
forge-1.19.2-43.1.47-universal.jar
[1.19.2] More Crafting Tables Forge 4.2.0.jar
plantableores-1.1.0-1.19.2.jar
Easy Emerald-1.19.2-3.3.6-[FORGE].jar
craftingtweaks-forge-1.19-15.1.0.jar
client-1.19.2-20220805.130853-srg.jar
theoneprobe-1.19-6.2.2.jar
appliedenergistics2-forge-12.8.4.jar
moonlight-1.19.2-2.1.9-forge.jar
MouseTweaks-forge-mc1.19-2.23.jar
ImmersiveEngineering-1.19.2-9.0.0-153.jar
PassiveGenerators_v.1.1.0_1.19.2.jar
spectrelib-forge-0.11.0+1.19.jar

Additional Context

this isn't a modpack made by a pro, is just a bunch of mods that i like 2 play arround create mod for a youtube series, so if im losing this world, the series is over after more than 1400 days in and a lot of foothage and edit will be lose, before even launch the series, so plz, if u can tell me a way to recover this? my last backup where 2 weeks ago! so is really old.

edgarogh commented 1 year ago

By the looks of things, this is caused by Refined Storage trying to cast (convert) the virtual schematics world (used internally by Create to represent your schematic) into an actual real ServerLevel which is how Minecraft stores your worlds. If you're using a relatively recent version of RS, this is the exact place where the invalid cast is attempted:

https://github.com/refinedmods/refinedstorage/blob/1951169f7bfc508b85d4d0cbceb6d7094782dc09/src/main/java/com/refinedmods/refinedstorage/blockentity/NetworkNodeBlockEntity.java#L63

This is definitely on issue on RS's side because they have no prior reasons to believe that the level here is actually a ServerLevel and not anything else. If I were you, I'd report this on Refined Storage's issue tracker. You can close this issue and still link it from there to provide context.

edgarogh commented 1 year ago

It seems like they're already aware of it actually: refinedmods/refinedstorage#3405

raoulvdberge commented 1 year ago

@edgarogh Ok, I corrected RS to check for ServerLevelAccessor since you appear to be using this on your SchematicWorld.

Now I'm getting this crash:

java.lang.IllegalStateException: Cannot use IServerWorld#getWorld in a client environment
    at com.simibubi.create.content.schematics.SchematicWorld.m_6018_(SchematicWorld.java:247) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.refinedmods.refinedstorage.blockentity.ControllerBlockEntity.getNetwork(ControllerBlockEntity.java:101) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at com.refinedmods.refinedstorage.blockentity.ControllerBlockEntity.getNode(ControllerBlockEntity.java:153) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at com.refinedmods.refinedstorage.blockentity.ControllerBlockEntity.getNode(ControllerBlockEntity.java:36) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at net.minecraftforge.common.util.LazyOptional.map(LazyOptional.java:195) ~[forge-1.19.2-43.1.32-universal.jar%23133!/:?] {re:classloading}
    at com.refinedmods.refinedstorage.block.CableBlock.isSideCovered(CableBlock.java:209) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at com.refinedmods.refinedstorage.block.CableBlock.hasNodeConnection(CableBlock.java:200) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at com.refinedmods.refinedstorage.block.CableBlock.getState(CableBlock.java:224) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at com.refinedmods.refinedstorage.block.CableBlock.m_7417_(CableBlock.java:121) ~[refinedstorage-1.11.2.jar%23127!/:1.11.2] {re:classloading}
    at net.minecraft.world.level.block.state.BlockBehaviour$BlockStateBase.m_60728_(BlockBehaviour.java:730) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading,re:mixin}
    at net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.m_74488_(StructureTemplate.java:353) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading}
    at net.minecraft.world.phys.shapes.DiscreteVoxelShape.m_82812_(DiscreteVoxelShape.java:225) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading}
    at net.minecraft.world.phys.shapes.DiscreteVoxelShape.m_82810_(DiscreteVoxelShape.java:203) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading}
    at net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.m_74510_(StructureTemplate.java:348) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading}
    at net.minecraft.world.level.levelgen.structure.templatesystem.StructureTemplate.m_230328_(StructureTemplate.java:312) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading}
    at com.simibubi.create.content.schematics.client.SchematicHandler.setupRenderer(SchematicHandler.java:160) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.simibubi.create.content.schematics.client.SchematicHandler.deploy(SchematicHandler.java:362) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.simibubi.create.content.schematics.client.tools.DeployTool.handleRightClick(DeployTool.java:106) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.simibubi.create.content.schematics.client.SchematicHandler.onMouseInput(SchematicHandler.java:263) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.simibubi.create.events.InputEvents.onMouseInput(InputEvents.java:55) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading}
    at com.simibubi.create.events.__InputEvents_onMouseInput_Pre.invoke(.dynamic) ~[create-1.19.2-0.5.0.f.jar%23124!/:0.5.0.f] {re:classloading,pl:eventbus:B}
    at net.minecraftforge.eventbus.ASMEventHandler.invoke(ASMEventHandler.java:73) ~[eventbus-6.0.3.jar%23106!/:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:315) ~[eventbus-6.0.3.jar%23106!/:?] {}
    at net.minecraftforge.eventbus.EventBus.post(EventBus.java:296) ~[eventbus-6.0.3.jar%23106!/:?] {}
    at net.minecraftforge.client.ForgeHooksClient.onMouseButtonPre(ForgeHooksClient.java:737) ~[forge-1.19.2-43.1.32-universal.jar%23133!/:?] {re:classloading}
    at net.minecraft.client.MouseHandler.m_91530_(MouseHandler.java:72) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.client.MouseHandler.m_168091_(MouseHandler.java:185) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?] {re:classloading,pl:runtimedistcleaner:A}
    at net.minecraft.util.thread.BlockableEventLoop.execute(BlockableEventLoop.java:103) ~[client-1.19.2-20220805.130853-srg.jar%23128!/:?]
edgarogh commented 1 year ago

Ohh sorry if there was a misunderstanding, I'm not in the Create team, nor even a code contributor. I was just trying to help people with the elementary modding knowledge I have.

I honestly don't know exactly how RS is architectured. All I was pointing out is that the cast from level to ServerLevel is unsafe because even if you check level.isClientSide beforehand in a guarding if, nothing tells you that a level that has isClientSide == false is actually a ServerLevel. In vanilla, this is most likely true as there are only ClientLevel and ServerLevel and no other implementors. But in a modded environment, more subclasses/implementors may exist.

Maybe here, you could check if (!(level instanceof ServerLevel)) instead? This would mean that in a schematic world, RS returns the client version of network nodes however, even on the server. I don't know if that would cause an issue.

But again I don't know exactly how RS works internally and if this solution wouldn't break things further.