Coordinates should be offset by 512 to reduce region files used
mctom987 opened this issue · 3 comments
Minor detail, but offsetting the X and Z coordinates by 512 will reduce the number of regions accessed for the machine.
Currently, Machine #0 is created at 0,0, and goes to 15,15, containing almost the entire chunk. This is fine, but if a player enters this machine, -1,-1 is in the render distance. This has the effect of forcing region files r.0.0.mca (the actual region containing the machine), as well as r.-1.-1.mca, r.-1.0.mca, and r.1.-1.mca to be generated as well.
If the machine were offset by 512, this would require a render distance of 32 to load other regions.
I have not tested the difference this makes, but at the very least it would simplify backups, and moreso restores, of individual machines. Less important, it saves a few kilobytes for a totally empty region.
I will look into this for CM4 on 1.13, but -unless I implement additional logic- it would break existing CM3 worlds.
While you’re at it, consider making this a config option. Personally, I’d like to have Compact Machines in the same chunk if possible, though I can see why that might be unadvisable for chunk loading reasons.
As for adding additional logic, would it be possible to only check such a value when the Compact Machines dimension is generated? Then you could change the default right now, and existing worlds would be fine.
Of course, I understand if you don’t want to bother. This isn’t a particularly urgent matter, and everyone will be forced to make new worlds for 1.13 anyway. There’s a fair argument to be made that the forced overhauls caused by Minecraft updates are actually part of the reason the modding community is so vibrant.