owengage / fastnbt

Fast serde serializer and deserializer for Minecraft's NBT and Anvil formats
MIT License
186 stars 34 forks source link

Does not support 1.17 maps with custom height range 'index out of bounds' if min_y is less than -64 #33

Closed lizelive closed 3 years ago

lizelive commented 3 years ago

The real MIN_Y is -2048 and MAX_Y 2016.

thread 'main' panicked at 'index out of bounds: the len is 24 but the index is 18446744073709551538', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/section_tower.rs:47:13
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

Any worlds created with this datapack that will allow you to reproduce. deeper_world.zip

thread 'main' panicked at 'index out of bounds: the len is 24 but the index is 18446744073709551538', /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/section_tower.rs:47:13
stack backtrace:
   0: rust_begin_unwind
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/std/src/panicking.rs:493:5
   1: core::panicking::panic_fmt
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:92:14
   2: core::panicking::panic_bounds_check
             at /rustc/53cb7b09b00cbea8754ffb78e7e3cb521cb8af4b/library/core/src/panicking.rs:69:5
   3: <fastanvil::java::section_tower::SectionTower as serde::de::Deserialize>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/section_tower.rs:47:13
   4: <serde::de::impls::OptionVisitor<T> as serde::de::Visitor>::visit_some
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/impls.rs:683:9
   5: <&mut fastnbt::de::Deserializer as serde::de::Deserializer>::deserialize_option
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:716:9
   6: serde::de::impls::<impl serde::de::Deserialize for core::option::Option<T>>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/impls.rs:703:9
   7: <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/mod.rs:785:9
   8: <fastnbt::de::CompoundAccess as serde::de::MapAccess>::next_value_seed
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:873:9
   9: serde::de::MapAccess::next_value
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/mod.rs:1846:9
  10: <fastanvil::java::_::<impl serde::de::Deserialize for fastanvil::java::Level>::deserialize::__Visitor as serde::de::Visitor>::visit_map
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/mod.rs:109:10
  11: fastnbt::de::consume_value
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:358:13
  12: <&mut fastnbt::de::Deserializer as serde::de::Deserializer>::deserialize_any
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:587:9
  13: <&mut fastnbt::de::Deserializer as serde::de::Deserializer>::deserialize_struct
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/macros.rs:134:13
  14: fastanvil::java::_::<impl serde::de::Deserialize for fastanvil::java::Level>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/mod.rs:109:10
  15: <core::marker::PhantomData<T> as serde::de::DeserializeSeed>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/mod.rs:785:9
  16: <fastnbt::de::CompoundAccess as serde::de::MapAccess>::next_value_seed
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:873:9
  17: serde::de::MapAccess::next_value
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/de/mod.rs:1846:9
  18: <fastanvil::java::_::<impl serde::de::Deserialize for fastanvil::java::JavaChunk>::deserialize::__Visitor as serde::de::Visitor>::visit_map
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/mod.rs:36:10
  19: <&mut fastnbt::de::Deserializer as serde::de::Deserializer>::deserialize_any
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:554:24
  20: <&mut fastnbt::de::Deserializer as serde::de::Deserializer>::deserialize_struct
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/serde-1.0.126/src/macros.rs:134:13
  21: fastanvil::java::_::<impl serde::de::Deserialize for fastanvil::java::JavaChunk>::deserialize
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastanvil-0.20.0/src/java/mod.rs:36:10
  22: fastnbt::de::from_bytes
             at /usr/local/cargo/registry/src/github.com-1ecc6299db9ec823/fastnbt-1.1.0/src/de.rs:277:13
  23: converter::main
             at ./src/main.rs:15:28
  24: core::ops::function::FnOnce::call_once
             at /usr/local/rustup/toolchains/1.53.0-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/ops/function.rs:227:5
note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
owengage commented 3 years ago

I've been wanting to look into this custom heights from 1.17. I shall investigate, thanks.

owengage commented 3 years ago

Should be fixed in fastanvil 0.21. :)

I tested it with a deep world and it seems to work. https://owengage.com/anvil/ should be updated with the new version.

If it still doesn't work let me know!