@@ -193,10 +193,9 @@ impl Encode for ChunkDataUpdateLightC<'_> {
193193
194194impl ChunkSection {
195195 pub fn anvil_to_sec ( value : & world:: Section , block_states : & Blocks ) -> Self {
196- let mut blocks: [ i16 ; 16 * 16 * 16 ] = [ 0 ; 16 * 16 * 16 ] ;
196+ let mut blocks = Vec :: new ( ) ;
197197 let bit_length = ( 64 - ( value. block_states . palette . len ( ) as u64 ) . leading_zeros ( ) ) . max ( 4 ) ;
198198
199- #[ cfg( not( feature = "modern_art" ) ) ]
200199 let blocks_per_long = 64 / bit_length;
201200
202201 #[ cfg( not( feature = "modern_art" ) ) ]
@@ -205,6 +204,9 @@ impl ChunkSection {
205204 match value. block_states . data {
206205 None => blocks. fill ( 0 ) ,
207206 Some ( ref data) => {
207+ trace ! ( "data.len(): {}" , data. len( ) ) ;
208+ trace ! ( "blocks_per_long: {blocks_per_long}" ) ;
209+ blocks. resize ( data. len ( ) * blocks_per_long as usize , 0 ) ;
208210 let mut i = 0 ;
209211 for long in data. iter ( ) {
210212 #[ cfg( not( feature = "modern_art" ) ) ]
@@ -248,6 +250,8 @@ impl ChunkSection {
248250 l => ( 64 - l. leading_zeros ( ) ) . max ( 4 ) as u8 ,
249251 } ;
250252
253+ trace ! ( "bit_length: {bit_length}" ) ;
254+
251255 let palette = {
252256 if bit_length == 15 {
253257 Palette :: Direct
@@ -273,7 +277,7 @@ impl ChunkSection {
273277 let data = match palette {
274278 Palette :: Direct | Palette :: Indirect ( ..) => {
275279 let blocks_per_long = 64 / bit_length;
276- let mut data = vec ! [ 0i64 ; ( 16 * 16 * 16 ) / blocks_per_long as usize ] ;
280+ let mut data = vec ! [ 0i64 ; blocks . len ( ) / blocks_per_long as usize ] ;
277281 let mut blocks_so_far = 0 ;
278282 let mut long_index = 0 ;
279283
0 commit comments