-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix an oopsie in chunk caches with dynamic world height #3375
base: 1.17.1
Are you sure you want to change the base?
Conversation
@@ -43,7 +43,7 @@ | |||
/** | |||
* Magic value to detect invalid cache files, or incompatible cache files saved in an old version of Baritone | |||
*/ | |||
private static final int CACHED_REGION_MAGIC = 456022910; | |||
private static final int CACHED_REGION_MAGIC = 456022911; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
am I supposed to just bump this, or roll some dice and pick new numbers, or what
@@ -166,7 +166,7 @@ public synchronized final void save(String directory) { | |||
out.writeShort(entry.getValue().size()); | |||
for (BlockPos pos : entry.getValue()) { | |||
out.writeByte((byte) (pos.getZ() << 4 | pos.getX())); | |||
out.writeByte((byte) (pos.getY())); | |||
out.writeInt(pos.getY()-dimension.minY()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it needs updating due to expanding the range of this
You guys gonna update this or are we going to change something ? |
I explained how it should be done here 05cc63f I'd like to see something like Also I don't see why we need to add and subtract out That should only happen on read. Writing a chunk should always do it the new way with the new magic. |
yeah, I suppose that doesn't need to be there as it'll be signed when read/writing, it will match the y value of the chunk data tho, since those are -minY to be able to shove into a long value |
I'm not sure if this is a good idea, this might cause issues with people who have old cache data that is wrong (incorrect y value currently from chunks parsed with worlds with -ymin values). |
mmmmmmmmmmmm I don't like that, with a patch to saving the Y coord I don't think that's a good idea anymore, want to undo that afterwards
I actually don't think this would cause any issues. Imagining you do Really, thinking on it now, the XYZ coordinate within the chunk of the interesting block doesn't matter lol. Saving it in RAM is good, but saving it on disk is a little pointless. I think we could get away just as well with the on-disk format just containing the quantity of blocks in the chunk, not their locations? |
tldr: given that the XYZ doesn't matter so much, my opinion is that it's much better to scrape together as much data as we can from older or incompatible caches, than to ignore it because its Y could be incorrect. |
goto spawner/chest isn't working properly without cache, so might need to fix a few things to do that... |
Reread what I said - "Saving it in RAM is good, but saving it on disk is a little pointless." If it's in the So I'm saying that actually I'm pretty sure goto spawner/chest would work perfectly without saving the XYZ of chest/spawner to disk. Just whether they're in the chunk or not (and maybe a quantity). |
Update: to be clear, packed CachedChunks SHOULD still store the XYZ list while in RAM. XYZ should only be discarded when written to disk, it should NOT be discarded when packed. The reason is scenarios like 2b2t spawn |
2b2t spawn is probably big enough it shouldnt be discarded on disk either... |
fixes
#mine chest
and some stuff not working properly