maruohon / litematica

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

Crash while saving a big schematic... #266

Open joex92 opened 3 years ago

joex92 commented 3 years ago

I was saving a schematic on a server with this dimensions: 1024X x 1024Z x 192Y corner1:[-512,62,-512] corner2:[511,255,511], pretty big, just doing a backup of the spawn (I've noticed that litematica keeps some block's rotation while WorldEdit doesn't) and got a #crash:

15:32:01.276 Unreported exception thrown!
java.lang.NegativeArraySizeException
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:38)
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:22)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.setBits(LitematicaBlockStateContainer.java:93)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.onResize(LitematicaBlockStateContainer.java:103)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStatePaletteHashMap.idFor(LitematicaBlockStatePaletteHashMap.java:35)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.set(LitematicaBlockStateContainer.java:54)
    at fi.dy.masa.litematica.schematic.LitematicaSchematic.takeBlocksFromWorldWithinChunk(LitematicaSchematic.java:1029)
    at fi.dy.masa.litematica.scheduler.tasks.TaskSaveSchematic.processChunk(TaskSaveSchematic.java:64)
    at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkBase.execute(TaskProcessChunkBase.java:51)
    at fi.dy.masa.litematica.scheduler.TaskScheduler.runTasks(TaskScheduler.java:65)
    at fi.dy.masa.litematica.scheduler.ClientTickHandler.onClientTick(ClientTickHandler.java:20)
    at fi.dy.masa.malilib.event.TickHandler.onClientTick(TickHandler.java:36)
    at net.minecraft.class_310.handler$zhc000$onPostKeyboardInput(class_310.java:5889)
    at net.minecraft.class_310.method_1574(class_310.java:1612)
    at net.minecraft.class_310.method_1523(class_310.java:1021)
    at net.minecraft.class_310.method_1514(class_310.java:681)
    at net.minecraft.client.main.Main.main(Main.java:215)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:224)
    at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:141)
    at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)
15:32:15.290 Stopping worker threads
15:32:47.322

---- Minecraft Crash Report ----
// My bad.

Time: 12/8/20 3:32 PM
Description: Unexpected error

java.lang.NegativeArraySizeException
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:38)
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:22)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.setBits(LitematicaBlockStateContainer.java:93)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.onResize(LitematicaBlockStateContainer.java:103)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStatePaletteHashMap.idFor(LitematicaBlockStatePaletteHashMap.java:35)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.set(LitematicaBlockStateContainer.java:54)
    at fi.dy.masa.litematica.schematic.LitematicaSchematic.takeBlocksFromWorldWithinChunk(LitematicaSchematic.java:1029)
    at fi.dy.masa.litematica.scheduler.tasks.TaskSaveSchematic.processChunk(TaskSaveSchematic.java:64)
    at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkBase.execute(TaskProcessChunkBase.java:51)
    at fi.dy.masa.litematica.scheduler.TaskScheduler.runTasks(TaskScheduler.java:65)
    at fi.dy.masa.litematica.scheduler.ClientTickHandler.onClientTick(ClientTickHandler.java:20)
    at fi.dy.masa.malilib.event.TickHandler.onClientTick(TickHandler.java:36)
    at net.minecraft.class_310.handler$zhc000$onPostKeyboardInput(class_310.java:5889)
    at net.minecraft.class_310.method_1574(class_310.java:1612)
    at net.minecraft.class_310.method_1523(class_310.java:1021)
    at net.minecraft.class_310.method_1514(class_310.java:681)
    at net.minecraft.client.main.Main.main(Main.java:215)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:224)
    at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:141)
    at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)

A detailed walkthrough of the error, its code path and all known details is as follows:
---------------------------------------------------------------------------------------

-- Head --
Thread: Render thread
Stacktrace:
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:38)
    at fi.dy.masa.litematica.schematic.container.LitematicaBitArray.<init>(LitematicaBitArray.java:22)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.setBits(LitematicaBlockStateContainer.java:93)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.onResize(LitematicaBlockStateContainer.java:103)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStatePaletteHashMap.idFor(LitematicaBlockStatePaletteHashMap.java:35)
    at fi.dy.masa.litematica.schematic.container.LitematicaBlockStateContainer.set(LitematicaBlockStateContainer.java:54)
    at fi.dy.masa.litematica.schematic.LitematicaSchematic.takeBlocksFromWorldWithinChunk(LitematicaSchematic.java:1029)
    at fi.dy.masa.litematica.scheduler.tasks.TaskSaveSchematic.processChunk(TaskSaveSchematic.java:64)
    at fi.dy.masa.litematica.scheduler.tasks.TaskProcessChunkBase.execute(TaskProcessChunkBase.java:51)
    at fi.dy.masa.litematica.scheduler.TaskScheduler.runTasks(TaskScheduler.java:65)
    at fi.dy.masa.litematica.scheduler.ClientTickHandler.onClientTick(ClientTickHandler.java:20)
    at fi.dy.masa.malilib.event.TickHandler.onClientTick(TickHandler.java:36)
    at net.minecraft.class_310.handler$zhc000$onPostKeyboardInput(class_310.java:5889)

-- Affected level --
Details:
    All players: 2 total; [class_746['joex92'/66843, l='ClientLevel', x=-20.06, y=152.37, z=-19.29], class_745['Viejo McDonald'/735, l='ClientLevel', x=-65.32, y=73.00, z=3.30]]
    Chunk stats: SodiumChunkCache: 495
    Level dimension: minecraft:overworld
    Level spawn location: World: (-1060,63,-1053), Chunk: (at 12,3,3 in -67,-66; contains blocks -1072,0,-1056 to -1057,255,-1041), Region: (-3,-3; contains chunks -96,-96 to -65,-65, blocks -1536,0,-1536 to -1025,255,-1025)
    Level time: 123488 game time, 200021047 day time
    Server brand: BungeeCord (git:BungeeCord-Bootstrap:1.16-R0.4-SNAPSHOT:9c078b7:1539) <- Paper
    Server type: Non-integrated multiplayer server
Stacktrace:
    at net.minecraft.class_638.method_8538(class_638.java:449)
    at net.minecraft.class_310.method_1587(class_310.java:2239)
    at net.minecraft.class_310.method_1514(class_310.java:704)
    at net.minecraft.client.main.Main.main(Main.java:215)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at net.fabricmc.loader.game.MinecraftGameProvider.launch(MinecraftGameProvider.java:224)
    at net.fabricmc.loader.launch.knot.Knot.init(Knot.java:141)
    at net.fabricmc.loader.launch.knot.KnotClient.main(KnotClient.java:27)

-- System Details --
Details:
    Minecraft Version: 1.16.4
    Minecraft Version ID: 1.16.4
    Operating System: Mac OS X (x86_64) version 10.13.6
    Java Version: 1.8.0_74, Oracle Corporation
    Java VM Version: Java HotSpot(TM) 64-Bit Server VM (mixed mode), Oracle Corporation
    Memory: 304267144 bytes (290 MB) / 3221225472 bytes (3072 MB) up to 3221225472 bytes (3072 MB)
    CPUs: 8
    JVM Flags: 8 total; -Xss1M -Xmx3G -XX:+UnlockExperimentalVMOptions -XX:+UseG1GC -XX:G1NewSizePercent=20 -XX:G1ReservePercent=20 -XX:MaxGCPauseMillis=50 -XX:G1HeapRegionSize=32M
    Fabric Mods: 
        amecsapi: Amecs API 1.1.1+mc1.16-rc1
        autoconfig1u: Auto Config v1 Updated 3.3.1
        blue_endless_jankson: jankson 1.2.0
        carpet: Carpet Mod in Fabric 1.4.17
        cloth-basic-math: Cloth Basic Math 0.5.1
        cloth-client-events-v0: Cloth Client Events v0 1.4.5
        cloth-config2: Cloth Config v4 4.8.3
        cmdkeybind: Command Macros 1.5.2-1.16
        connected_block_textures: Connected Block Textures 0.1.2+1.16.4
        cotton-config: Cotton Config 1.0.0-rc.7
        cotton-logging: Cotton Logging 1.0.0-rc.4
        dark-loading-screen: Dark Loading Screen 1.5.0
        dynamicsoundfilters: Dynamic Sound Filters 1.1.3+1.16.2
        enchantedtooltips: Enchanted ToolTips 1.3.4-1.16
        fabric: Fabric API 0.26.0+1.16
        fabric-api-base: Fabric API Base 0.2.0+ba858fb83a
        fabric-biome-api-v1: Fabric Biome API (v1) 3.1.0+2e23b97c3a
        fabric-blockrenderlayer-v1: Fabric BlockRenderLayer Registration (v1) 1.1.4+6a2618f53a
        fabric-command-api-v1: Fabric Command API (v1) 1.0.9+6a2618f53a
        fabric-commands-v0: Fabric Commands (v0) 0.2.0+6a2618f53a
        fabric-containers-v0: Fabric Containers (v0) 0.1.8+6a2618f53a
        fabric-content-registries-v0: Fabric Content Registries (v0) 0.1.9+6a2618f53a
        fabric-crash-report-info-v1: Fabric Crash Report Info (v1) 0.1.2+b7f9825d3a
        fabric-events-interaction-v0: Fabric Events Interaction (v0) 0.4.1+6a2618f53a
        fabric-events-lifecycle-v0: Fabric Events Lifecycle (v0) 0.2.0+16acbe5ba7
        fabric-game-rule-api-v1: Fabric Game Rule API (v1) 1.0.3+a4467d2a3a
        fabric-item-api-v1: Fabric Item API (v1) 1.2.0+6a2618f53a
        fabric-item-groups-v0: Fabric Item Groups (v0) 0.2.1+6a2618f53a
        fabric-key-binding-api-v1: Fabric Key Binding API (v1) 1.0.1+730711c63a
        fabric-keybindings-v0: Fabric Key Bindings (v0) 0.2.0+6a2618f53a
        fabric-lifecycle-events-v1: Fabric Lifecycle Events (v1) 1.2.0+6a2618f53a
        fabric-loot-tables-v1: Fabric Loot Tables (v1) 1.0.1+6a2618f53a
        fabric-mining-levels-v0: Fabric Mining Levels (v0) 0.1.2+6a2618f53a
        fabric-models-v0: Fabric Models (v0) 0.1.1+6a2618f53a
        fabric-networking-blockentity-v0: Fabric Networking Block Entity (v0) 0.2.5+6a2618f53a
        fabric-networking-v0: Fabric Networking (v0) 0.1.10+e00ecb5fa7
        fabric-object-builder-api-v1: Fabric Object Builder API (v1) 1.9.2+6a2618f53a
        fabric-object-builders-v0: Fabric Object Builders (v0) 0.7.1+6a2618f53a
        fabric-particles-v1: fabric-particles-v1 0.2.2+6a2618f53a
        fabric-registry-sync-v0: Fabric Registry Sync (v0) 0.6.1+6a2618f53a
        fabric-renderer-api-v1: Fabric Renderer API (v1) 0.3.3+6a2618f53a
        fabric-renderer-indigo: Fabric Renderer - Indigo 0.4.3+6a2618f53a
        fabric-renderer-registries-v1: Fabric Renderer Registries (v1) 2.2.0+6a2618f53a
        fabric-rendering-data-attachment-v1: Fabric Rendering Data Attachment (v1) 0.1.4+6a2618f53a
        fabric-rendering-fluids-v1: Fabric Rendering Fluids (v1) 0.1.12+6a2618f53a
        fabric-rendering-v0: Fabric Rendering (v0) 1.1.1+6a2618f53a
        fabric-rendering-v1: Fabric Rendering (v1) 1.4.0+6a2618f53a
        fabric-resource-loader-v0: Fabric Resource Loader (v0) 0.3.2+1944f3e03a
        fabric-screen-handler-api-v1: Fabric Screen Handler API (v1) 1.1.0+6a2618f53a
        fabric-structure-api-v1: Fabric Structure API (v1) 1.1.0+f8ac1db23a
        fabric-tag-extensions-v0: Fabric Tag Extensions (v0) 1.0.3+6a2618f53a
        fabric-textures-v0: Fabric Textures (v0) 1.0.5+6a2618f53a
        fabric-tool-attribute-api-v1: Fabric Tool Attribute API (v1) 1.2.5+6a2618f53a
        fabricloader: Fabric Loader 0.10.8
        fiber: fiber 0.23.0-2
        held-item-info: Held Item Info 1.1.3
        horsestatsvanilla: Horse Stats Vanilla 4.1.3
        itemscroller: Item Scroller 0.15.0-dev.20201103.183933
        jankson: Jankson 3.0.1+j1.2.0
        kirin: Kirin UI 1.7-1.16.2
        kyrptconfig: Kytpt Config 1.1.5-1.16
        lambdynlights: LambDynamicLights 1.3.2+1.16.4
        libgui: LibGui 3.0.0-beta.1+1.16.2-rc2
        lightoverlay: Light Overlay 5.5.4
        litematica: Litematica 0.0.0-dev.20201103.184101
        lithium: Lithium 0.6.0
        lithium-api: Lithium API 0.6.0
        malilib: MaLiLib 0.10.0-dev.21+arne.1
        minecraft: Minecraft 1.16.4
        minihud: MiniHUD 0.19.0-dev.20201103.184029
        modmenu: Mod Menu unspecified
        mousewheelie: Mouse Wheelie 1.5.10+mc1.16.4
        multiconnect: MultiConnect 1.3.34
        multiconnect-api: MultiConnect API 1.3.34
        mybrightness: MyBrightness Fabric 1.16pre2-08
        okzoomer: Ok Zoomer 4.0.1+1.16.2
        orderly: Orderly 2.0.0-alpha.10-1.16
        phosphor: Phosphor 0.6.0+build.7
        presencefootsteps: Presence Footsteps r28+1.16.2
        right-click-clear: Right Click Clear 2.0.2
        roughlyenoughitems: Roughly Enough Items 5.8.5
        roughlyenoughitems-api: REI (API) 5.8.5
        roughlyenoughitems-default-plugin: REI (Default Plugin) 5.8.5
        roughlyenoughitems-runtime: REI (Runtime) 5.8.5
        screenshotclipboard: Screenshot to Clipboard 1.0.6
        sodium: Sodium 0.1.0
        spruceui: SpruceUI 1.6.4
        tweakeroo: Tweakeroo 0.10.0-dev.20201110.132827
        tweed: Tweed API 3.0.0-beta.20
        voxelmap: VoxelMap 1.10.11
        window_title_changer: Window Title Changer 2.1.0-1.16.2
        winwonders: Window Wonders 0.1.2
        worldedit: WorldEdit 7.2.0+a51fa43
        worldeditcui: WorldEditCUI 1.16.2+01
    Launched Version: fabric-loader-0.10.8-1.16.4
    Backend library: LWJGL version 3.2.1 build 12
    Backend API: NVIDIA GeForce GT 650M OpenGL Engine GL version 2.1 NVIDIA-10.32.0 355.11.10.10.40.102, NVIDIA Corporation
    GL Caps: Using framebuffer using ARB_framebuffer_object extension
    Using VBOs: Yes
    Is Modded: Definitely; Client brand changed to 'fabric'
    Type: Client (map_client.txt)
    GPU Warnings: version: 2.1
    Graphics mode: fast
    Resource Packs: vanilla, fabric/fabric-renderer-api-v1, fabric/fabric-keybindings-v0, fabric/dynamicsoundfilters, fabric/fabricloader, fabric/fabric-containers-v0, fabric/fabric-object-builder-api-v1, fabric/fabric-game-rule-api-v1, fabric/fabric-api-base, fabric/fabric-rendering-data-attachment-v1, fabric/mybrightness, fabric/fabric-textures-v0, fabric/worldeditcui, fabric/fabric-rendering-fluids-v1, fabric/fabric-blockrenderlayer-v1, fabric/fabric-lifecycle-events-v1, fabric/fabric-renderer-registries-v1, fabric/fabric-loot-tables-v1, fabric/fabric, fabric/fabric-networking-v0, fabric/fabric-screen-handler-api-v1, fabric/fabric-networking-blockentity-v0, fabric/horsestatsvanilla, fabric/modmenu, fabric/fabric-command-api-v1, fabric/jankson, fabric/fabric-tool-attribute-api-v1, fabric/fabric-renderer-indigo, fabric/fabric-crash-report-info-v1, fabric/fabric-events-interaction-v0, fabric/fabric-item-api-v1, fabric/orderly, fabric/libgui, fabric/fabric-rendering-v0, fabric/fabric-rendering-v1, fabric/fabric-key-binding-api-v1, fabric/cloth-config2, fabric/fabric-resource-loader-v0, fabric/autoconfig1u, fabric/fabric-content-registries-v0, fabric/fabric-tag-extensions-v0, fabric/fabric-biome-api-v1, fabric/window_title_changer, fabric/fabric-registry-sync-v0, fabric/fabric-mining-levels-v0, fabric/fabric-events-lifecycle-v0, fabric/fabric-models-v0, fabric/fabric-item-groups-v0, fabric/fabric-object-builders-v0, fabric/amecsapi, fabric/carpet, fabric/cmdkeybind, fabric/connected_block_textures, fabric/dark-loading-screen, fabric/enchantedtooltips, fabric/held-item-info, fabric/itemscroller (incompatible), fabric/lambdynlights, fabric/lightoverlay (incompatible), fabric/litematica (incompatible), fabric/lithium, fabric/malilib (incompatible), fabric/minihud (incompatible), fabric/mousewheelie, fabric/multiconnect, fabric/multiconnect-api, fabric/okzoomer, fabric/phosphor, fabric/presencefootsteps (incompatible), fabric/right-click-clear, fabric/roughlyenoughitems, fabric/roughlyenoughitems-runtime, fabric/screenshotclipboard, fabric/sodium, fabric/spruceui, fabric/tweakeroo (incompatible), fabric/tweed (incompatible), fabric/voxelmap (incompatible), fabric/worldedit (incompatible), file/Depixel.zip, file/Depixel 3D.zip
    Current Language: English (US)
    CPU: 8x Intel(R) Core(TM) i7-3720QM CPU @ 2.60GHz
#@!@# Game crashed! Crash report saved to: #@!@# /Users/joex/Library/Application Support/minecraft/home/Fabric-1.16.4/crash-reports/crash-2020-12-08_15.32.19-client.txt
Saving all world maps.............
15:34:51.001 Process crashed with exit code 255

why was it? memory issues?

maruohon commented 3 years ago

Looks like it already overflows the backing long array. I'm not sure why it happens already with this size schematic, as it should be nowhere near the maximum size yet. Or wait... I think this might have been the index handling bug I fixed a while back in 1.12.2, but that fix is not yet in 1.13.2+.

So for now you can work around the issue by using for example 4 (or even 9 or 16) different sub-regions in the selection, that will cut down the size of the backing array, as each sub-region is saved separately. Also if possible you could try to cut down the size even more by using less tall boxes for the base terrain, and if there are tall castles/buildings/etc then capture just those over the base box with their own separate sub-region boxes, to avoid huge volumes of just empty space in the main boxes. That will both cut down the file size and the in-memory size of the schematic, and also help a bunch with the performance when you go and load the schematic later, as those massive empty areas don't have to be copied to the schematic world and tried to be rendered.

joex92 commented 3 years ago

oh ok, I get it... so while the "index handling bug" is fixed, use separate subregions for big schematics, right? That would be no problem, although this is weird, because before creating that schematic, I was saving many subregions before and one of them was wider, I believe, but not as tall as this one, and didn't get any errors nor crashes... maybe because it wasn't as tall as this one I suppose... anyways, thanks...

maruohon commented 3 years ago

I believe the bug is related to the total volume of the sub-region, not to any one dimension of it. But I can't remember the exact details of it anymore.

And using multiple as small as possible sub-regions is always recommended (for moderate to large scale schematics at least) due to the reasons I explained, not just to work around this bug. Of course it does not make any kind of real noticeable difference in smaller schematics that are only like some 10-30 blocks in total dimensions, and in very small schematics using a dozen sub-regions that are like 1-4 blocks each is most likely counter-productive already. But even in such cases, if it's for example a technical contraption with multiple different logical parts, it might make sense to use sub-regions, as it allows you to turn on/off parts (any of the sub-regions) of the placement, or move or rotate them relative to everything else.

joex92 commented 3 years ago

I get your point, and it's logical, there is no point in creating a schematic with mostly air blocks, but on the other hand making many subregions are a bit tedious... I'll still follow your recommendation but how about this:

anyways, thanks... next time I'll create smaller subregions...

maruohon commented 3 years ago

Subdividing an area seems like a good feature, but I think I'll do it as a manually triggered feature, so that you can click a button and it will subdivide the selected sub-region box, probably giving you a small popup to select how to subdivide it, or something like that.

The schematic format Litematica uses basically has an array of blocks, so each position within the area gets saved to that array, you can't leave out any positions. The vanilla structure block format on the other hand saves a list of blocks, and each entry contains the block type and the position, so in that format you could leave out air blocks. But on the other hand that format is WAAAY more verbose and space-inefficient per position. Because the array in Litematica uses a palette-based bit-packed format, where each block position uses an amount of bits per entry that depends on the total number of unique block states within that array/sub-region. Whereas the vanilla format stores I think 4 int tags inside a compound tag for each position... (all contained within a list tag)

But I might also add more optional "sub-formats" in the future, maybe a sparse custom format of some kind, and maybe also an RLE based format of some kind. But after that array handling bug fix arrives in 1.13.2+ versions, the current format will take you pretty far as well (in regards to the maximum area size), although the memory requirement for a maximum size sub-region would be around (2^31 - 1) * 8 = 16 GB. I believe the maximum dimensions of that sub-region (unless I made a mistake), assuming the region contains ALL the current existing block states in 1.16 (17 112 states), is 5982 x 256 x 5982.

But also one thing to keep in mind is that Litematica is not meant as a world download type of mod, as the schematic is always saved in one file and has to be loaded into memory all at once. There is a separate World Downloader mod for use cases where you want to just download everything in the world (within the client's loaded area) into a local copy: https://github.com/Pokechu22/WorldDownloader/releases

joex92 commented 3 years ago

oh ok I get it... I just wanted to save the spawn place, it's easier for me to be able to place a schematic than having a secondary world with what I need... that other mod, is it for Fabric as well?

Now, on the sub-region feature, I have some ideas:

  1. once selected a region change the tool to a divide tool where you can subdivide the region through the side you are pointing:
    
    Z
    |#########
    |#       # 
    |#   >   #  so if I'm here inside a region pointing at X+ and right click on any block in that line...
    |#       #
    |#########
    |_________ X

Z |######### |# # |######### the region will be divided there... |# # |######### |_____ X

Z |######### |# V # And if then I point towards Z- after creating that subdivision, while holding the "action key" (don't remember right now how was it called, in my case I press the Alt key) and scroll that way, the subdivision will move that direction |#########
|# # |######### |_____ X

Z |######### |# V #
|# # like this... |######### |######### |_____ X


- for Y subdivision it could be a secondary tool mode where you just click on the block height where you want to create a subdivision...
- the creation and modification of subregions could also be made in the litematica menu, just like when creating a region you give both corners, this time you would give the value and axis where to create the subdivision

- so subdivisions could cross between them... finally when you decided your subdivisions, you press a key or something to create the subregions, the subregions' name could be the main region + sequential number of regions, and boom, subregions created... on top of that, before creating the subregions, you could add an option to "cap" the max and min Y height to the highest and lowest non-air block inside the subregion (could be also for X and Z axises), that way subregions won't have so many air blocks stored, this could also be of use if somehow after subdividing there are subregions with air only, in that case the subregion won't be saved/created if the option is enabled... it should be an option because sometimes, in my case, I use the air blocks space to help me to know a determined height when placing the schematic, then I enable the option to not place air blocks... 

2. given the selected big area, create subregions that have not been naturally generated... I really don't know if this could be done client-side, the only way it comes to my mind mind is to give the seed to litematica, that way it can know which part were naturally generated and which part weren't... this mode would enclose each region on the 3 axises, even if it is underground... although you'll have to set also the max space between blocks to create the subregions, otherwise it will create a subregion for each block or all the subregions inside 1 region, that could also be useful... idk, I just believe that this could be a really good idea...

3. path dividing... almost the same as the first one, but instead of placing each subdivision, create the subdivisions given a path... similar to WorldEdit poly selection method, click on the vertices points of the path and create the subdivisions according to that path, so if you do a L shape path, it will divide the region in 4, because the subregions can only be box-shaped...

well, that's what I can come up... also, is it possible to be able for the regions be sphere shaped or poly-shaped? that's the only thing that I sometimes prefer using WorldEdit... but anyways, thanks for answering... I hope I could be of help...
maruohon commented 3 years ago

To me this seems like an extremely complex system that probably only like maybe a dozen people would ever end up actually using. And it would probably take tens if not hundreds of hours of development time to implement and test and debug all of this. So I don't think it's worth the development time and the added complexity in the code base to add this many options on how to sub-divide things.

So I think I would just go for the simple automatic sub-division on a given sub-region, based on either how many boxes you want per axis, or what should be the maximum size of each box. And another thing that might help is optionally capping the manual tool selections to not overlap with other existing sub-regions, it could speed up the process of just manually selecting stuff and creating sub-regions that are side by side but should not overlap.

joex92 commented 3 years ago

oh ok I understand... then... what about at least add an option to automatically shrink regions up to the farthest non-air block in the given axis? or to expand to the farthest non-air block in the given axis? or at least only in the Y axis... that could be something many users could be using... 🤷🏼‍♂️

maruohon commented 3 years ago

Hmm, there are already the selectionGrow and selectionShrink hotkeys that do those grow/shrink actions on all axes. But there isn't current a way to lock any of the axes in the area selection boxes, only in the placement configuration you can lock the origin axes to be able to just move on one axis for example. So using that same axis locking system for the selection boxes would be easy enough I think.