maruohon / litematica

A modern client-side schematic mod for Minecraft
GNU Lesser General Public License v3.0
723 stars 217 forks source link

Game crash when pasting schematic that exceeds build hieght #507

Open lumberwand opened 2 years ago

lumberwand commented 2 years ago

The game will crash when attempting to paste a schematic above the build height at y319

TheFantasticLoki commented 2 years ago

I'm getting a similar crash but pasting within normal pre 1.18 build height but in a world that has -64 - 319 build limit.

[19:50:23] [Render thread/ERROR]: Unreported exception thrown! java.lang.ArrayIndexOutOfBoundsException: Index 320 out of bounds for length 320 at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.combineStripsToLayers(TaskPasteSchematicPerChunkCommand.java:664) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.generateFillVolumes(TaskPasteSchematicPerChunkCommand.java:552) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.prepareSettingBlocks(TaskPasteSchematicPerChunkCommand.java:141) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.onStartNextBox(TaskPasteSchematicPerChunkCommand.java:129) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkMultiPhase.startNextBox(TaskProcessChunkMultiPhase.java:202) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.onNextChunkFetched(TaskPasteSchematicPerChunkCommand.java:121) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkMultiPhase.fetchNextChunk(TaskProcessChunkMultiPhase.java:181) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkMultiPhase.executeMultiPhase(TaskProcessChunkMultiPhase.java:97) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.tasks.TaskPasteSchematicPerChunkCommand.execute(TaskPasteSchematicPerChunkCommand.java:104) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.TaskScheduler.runTasks(TaskScheduler.java:65) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.litematica.scheduler.ClientTickHandler.onClientTick(ClientTickHandler.java:33) ~[litematica-fabric-1.18.2-0.11.0.jar:?] at fi.dy.masa.malilib.event.TickHandler.onClientTick(TickHandler.java:36) ~[malilib-fabric-1.18.2-0.12.0.jar:?] at net.minecraft.class_310.handler$bmg000$onPostKeyboardInput(class_310.java:12968) ~[client-intermediary.jar:?] at net.minecraft.class_310.method_1574(class_310.java:1817) ~[client-intermediary.jar:?] at net.minecraft.class_310.method_1523(class_310.java:1091) ~[client-intermediary.jar:?] at net.minecraft.class_310.method_1514(class_310.java:737) [client-intermediary.jar:?] at net.minecraft.client.main.Main.main(Main.java:236) [client-intermediary.jar:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:416) [loader-v2-latest.jar:?] at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:77) [loader-v2-latest.jar:?] at me.deftware.weaver.Main.main(Main.java:23) [weaver-1.0.0.jar:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:?] at jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77) ~[?:?] at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:?] at java.lang.reflect.Method.invoke(Method.java:568) ~[?:?] at org.multimc.onesix.OneSixLauncher.launchWithMainClass(OneSixLauncher.java:210) [NewLaunch.jar:?] at org.multimc.onesix.OneSixLauncher.launch(OneSixLauncher.java:245) [NewLaunch.jar:?] at org.multimc.EntryPoint.listen(EntryPoint.java:143) [NewLaunch.jar:?] at org.multimc.EntryPoint.main(EntryPoint.java:34) [NewLaunch.jar:?]

TheFantasticLoki commented 2 years ago

After relaunching minecraft after the crash my schematic seems to have encountered corruption and is missing entire chunks: image

TheFantasticLoki commented 2 years ago

After relaunching minecraft after the crash my schematic seems to have encountered corruption and is missing entire chunks: image

This just seems to be some form of rendering issue and not actually a corrupted schematic. Still tho No matter what I do I can't seem to find a good way to paste this schematic into my new world.

maruohon commented 2 years ago

@TheFantasticLoki This bug happens in the fairly recently added /fill-command based paste code. I don't know yet why it would get the incorrect world bounds in this case... That needs to be debugged later on.

Until I add a fix for this, you can try first pasting the lower part (up to y = 127) by using the Render Layers in the All Below mode for example. And then you can disable the fill-based pasting in Generic -> pasteUseFillCommand and use the older pure /setblock based mode to paste the top part of it for now (now in All Above mode and/or using paste replace behavior None).

TheFantasticLoki commented 2 years ago

Well no crash so far in the pasting of under 127 so that's good but I am CONSTANTLY getting no blocks were filled error in chat.

maruohon commented 2 years ago

That error happens in the /setblock command if it tries to set the same block that is already in that position. I'm still not sure why it happens so much with the paste task, as it's not supposed to try to set the block if it's already in the correct state. I think it must run twice for some positions or something...

TheFantasticLoki commented 2 years ago

Well and if you had said that the schematic I am trying to paste is out of the scope of litematica i TOTALLY would understand cause usually I import this just through region files but I keep getting Could not de-serialize chunk data for task and Data for local chunk could not be recovered. That's why I am trying with litematica in the first place but this build is 1kx1k by 0-256 in height. It's fucking massive

maruohon commented 2 years ago

Well Litematica is not really ideal for "world download" type of things, but it should still work for the most part.

But in this type of case where you seem to have a massive box around the entire area, and it's mostly empty space around the build, I would really recommend using the Normal (Multi-Region) area selection mode with multiple sub-region boxes around the builds you actually want to save, instead of a gigantic selection box around the entire area that has the buildings somewhere inside it. That would b e both beneficial for performance when loading or moving the schematic, and also for the paste task so that it doesn't need to handle so much pointless empty space.

TheFantasticLoki commented 2 years ago

The schematic isn't rendering anything above 190 I assume due to the -64 build height

TheFantasticLoki commented 2 years ago

Refuses to paste anything above 190 as well as the rendering issue even tho it's not present in the single player world but that world only goes from 0-256.

TheFantasticLoki commented 2 years ago

Should set the world height max/min to 2048/-2048 since that's the theoretical max height in 1.18+. My server takes advantage of this new height limit in all 3 dimensions but from -64-320 in overworld and the end and 0-256 in the nether. Other servers and especially single player worlds can implement this as well since it's just datapacks.

TheFantasticLoki commented 2 years ago

Is there a possibility I can get a custom build made that supports this since I can't even manually build the rest with just the overlay since it refuses to render?

maruohon commented 2 years ago

Are you able to place and break blocks as a player within that full -64 ... 319 range? Somehow the mod isn't seeing the correct world height range then, but normally it should use what the vanilla world reports as the world bottom and top range in 1.17+. Does this only happen on that server?

TheFantasticLoki commented 2 years ago

Yes I can place and break blocks within that full range in all dimensions. and idk if it's bugged on other servers since my server is one of the only ones I play on + idk many others that have adopted the custom build ranges yet. But it's one of the MAIN features of my server.

TheFantasticLoki commented 2 years ago

I'll quickly make a testing world in single player with the same build ranges and see if it bugs but if you want to come do testing on my server the ip is: mc.lokiverse.com and I can give you op for testing.

TheFantasticLoki commented 2 years ago

Also server is on 1.17.1 not 1.18.2 due to plugins not being up to date yet.

TheFantasticLoki commented 2 years ago

But I was using 1.18.2 to connect with ViaFabric so could that be causing part of the problem?

maruohon commented 2 years ago

Yes that's what I'm kind of suspecting, that the client for whatever reason does not have the correct world bottom and top limits set. A MC version conversion plugin or mod might well be the cause of that, but it's kind of strange if you can still place and break blocks as a player and the vanilla terrain rendering works in the full range. I don't know/remember all the code details off the top of my head for this stuff, i.e. what checks the rendering or the block placement uses on the client side to check what the world height is.

TheFantasticLoki commented 2 years ago

ffs I'm having so many problems. Couldn't get my 1.17.1 to launch and now my schematics are Quote unsupported or future version. Testing is so annoying.

maruohon commented 2 years ago

You need to use the latest available 1.17.1 version (0.9.0+) if you want to load 1.18+ schematics, it allows loading version 6 schematics.

Also could you hop on to my Discord server? (https://discord.gg/2FgywHj) Handling "message spammy" issues via GitHub is kinda annoying, as I get emails and Discord bot messages from each message here.

maruohon commented 2 years ago

What was the outcome of this ticket? Was there a solution?

I can't remember at all...

But if the server is running 1.8 then how does it even support anything past the 0 - 255 y range (at least on the clients)?