Closed ToBinio closed 1 year ago
maby i misunderstood something about
y_range()
becouse if i try getting a block from the lowest y it always fails. this is true forcomplete::chunk
but also forCurrentJavaChunk
-64 should be the lowest y value that is valid for a Minecraft chunk nowadays correct? Is that what's failing?
normaly -64 is the lowest, yes.
it is also the lowest y a block can be read from.
but why does y_range()
return -80 then?
I can't replicate the -80.
Running the following with a random region file from one of my worlds:
fn main() {
let args: Vec<_> = std::env::args().skip(1).collect();
let file = std::fs::File::open(args[0].clone()).unwrap();
let mut region = Region::from_stream(file).unwrap();
for chunk in region.iter().flatten() {
let chunk: CurrentJavaChunk = from_bytes(&chunk.data).unwrap();
let range = chunk.y_range();
println!("{:?}", range);
}
}
and I get lots of:
-64..320
-64..320
-64..320
-64..320
-64..320
as expected.
ok... i kinda figured it out.
it seems like on of my mods (only perfomance optimizations) does something weird with the world data.
Not sure how far you want to take this PR. The basic structure is here and allows iterating over blocks in a read only way. I'm happy for that to be this PR.
I might be interested in working on top of this to make it serializable back into a region file, if you're not already interested in doing so.
just wanted to add the most basic pre18 | pre13 support.
btw... thanks for your always quick answers, and for letting me work on this
Sounds great, and no problem. Thank you for contributing.
Let me know when the PR is ready and I'll have a look again.
this would be the basic structure of
complete::chunk
its not even close to being finished. But i wanted to check if you thought about it like this.
any thoughts on the structure?
maby i misunderstood something about
y_range()
becouse if i try getting a block from the lowest y it always fails. this is true forcomplete::chunk
but also forCurrentJavaChunk