@@ -4,15 +4,15 @@ use pumpkin_util::math::{vector2::Vector2, vector3::Vector3};
4
4
use crate :: {
5
5
biome:: { BiomeSupplier , MultiNoiseBiomeSupplier } ,
6
6
block:: { ChunkBlockState , registry:: get_state_by_state_id} ,
7
- chunk:: { CHUNK_AREA , CHUNK_WIDTH } ,
7
+ chunk:: CHUNK_AREA ,
8
8
generation:: { biome, positions:: chunk_pos} ,
9
9
} ;
10
10
11
11
use super :: {
12
12
GlobalRandomConfig ,
13
13
aquifer_sampler:: { FluidLevel , FluidLevelSampler , FluidLevelSamplerImpl } ,
14
14
biome_coords,
15
- chunk_noise:: { ChunkNoiseGenerator , LAVA_BLOCK , WATER_BLOCK } ,
15
+ chunk_noise:: { CHUNK_DIM , ChunkNoiseGenerator , LAVA_BLOCK , WATER_BLOCK } ,
16
16
height_limit:: HeightLimitView ,
17
17
noise_router:: {
18
18
multi_noise_sampler:: { MultiNoiseSampler , MultiNoiseSamplerBuilderOptions } ,
@@ -106,8 +106,7 @@ impl<'a> ProtoChunk<'a> {
106
106
) -> Self {
107
107
let generation_shape = & settings. noise ;
108
108
109
- let horizontal_cell_count =
110
- CHUNK_WIDTH / generation_shape. horizontal_cell_block_count ( ) as usize ;
109
+ let horizontal_cell_count = CHUNK_DIM / generation_shape. horizontal_cell_block_count ( ) ;
111
110
112
111
// TODO: Customize these
113
112
let sampler = FluidLevelSampler :: Chunk ( StandardChunkFluidLevelSampler :: new (
@@ -122,7 +121,7 @@ impl<'a> ProtoChunk<'a> {
122
121
let sampler = ChunkNoiseGenerator :: new (
123
122
base_router,
124
123
random_config,
125
- horizontal_cell_count,
124
+ horizontal_cell_count as usize ,
126
125
start_x,
127
126
start_z,
128
127
generation_shape,
@@ -136,16 +135,19 @@ impl<'a> ProtoChunk<'a> {
136
135
biome_coords:: from_block ( start_z) ,
137
136
) ;
138
137
let horizontal_biome_end = biome_coords:: from_block (
139
- horizontal_cell_count * generation_shape. horizontal_cell_block_count ( ) as usize ,
138
+ horizontal_cell_count * generation_shape. horizontal_cell_block_count ( ) ,
139
+ ) ;
140
+ let multi_noise_config = MultiNoiseSamplerBuilderOptions :: new (
141
+ biome_pos. x ,
142
+ biome_pos. z ,
143
+ horizontal_biome_end as usize ,
140
144
) ;
141
- let multi_noise_config =
142
- MultiNoiseSamplerBuilderOptions :: new ( biome_pos. x , biome_pos. z , horizontal_biome_end) ;
143
145
let multi_noise_sampler = MultiNoiseSampler :: generate ( base_router, & multi_noise_config) ;
144
146
145
147
let surface_config = SurfaceHeightSamplerBuilderOptions :: new (
146
148
biome_pos. x ,
147
149
biome_pos. z ,
148
- horizontal_biome_end,
150
+ horizontal_biome_end as usize ,
149
151
generation_shape. min_y as i32 ,
150
152
generation_shape. max_y ( ) as i32 ,
151
153
generation_shape. vertical_cell_block_count ( ) as usize ,
@@ -166,8 +168,8 @@ impl<'a> ProtoChunk<'a> {
166
168
. into_boxed_slice ( ) ,
167
169
flat_biome_map : vec ! [
168
170
Biome :: Plains ;
169
- biome_coords:: from_block( CHUNK_WIDTH )
170
- * biome_coords:: from_block( CHUNK_WIDTH )
171
+ biome_coords:: from_block( CHUNK_DIM as usize )
172
+ * biome_coords:: from_block( CHUNK_DIM as usize )
171
173
* biome_coords:: from_block( height as usize )
172
174
]
173
175
. into_boxed_slice ( ) ,
@@ -182,8 +184,8 @@ impl<'a> ProtoChunk<'a> {
182
184
assert ! ( local_pos. y < self . noise_sampler. height( ) as i32 && local_pos. y >= 0 ) ;
183
185
assert ! ( local_pos. z >= 0 && local_pos. z <= 15 ) ;
184
186
}
185
- self . noise_sampler . height ( ) as usize * CHUNK_WIDTH * local_pos. x as usize
186
- + CHUNK_WIDTH * local_pos. y as usize
187
+ self . noise_sampler . height ( ) as usize * CHUNK_DIM as usize * local_pos. x as usize
188
+ + CHUNK_DIM as usize * local_pos. y as usize
187
189
+ local_pos. z as usize
188
190
}
189
191
@@ -200,9 +202,9 @@ impl<'a> ProtoChunk<'a> {
200
202
}
201
203
202
204
biome_coords:: from_block ( self . noise_sampler . height ( ) as usize )
203
- * biome_coords:: from_block ( CHUNK_WIDTH )
205
+ * biome_coords:: from_block ( CHUNK_DIM as usize )
204
206
* local_biome_pos. x as usize
205
- + biome_coords:: from_block ( CHUNK_WIDTH ) * local_biome_pos. y as usize
207
+ + biome_coords:: from_block ( CHUNK_DIM as usize ) * local_biome_pos. y as usize
206
208
+ local_biome_pos. z as usize
207
209
}
208
210
@@ -266,7 +268,7 @@ impl<'a> ProtoChunk<'a> {
266
268
let block_y = section_coords:: section_to_block ( i) ;
267
269
let start_y = biome_coords:: from_block ( block_y) ;
268
270
269
- let biomes_per_section = biome_coords:: from_block ( CHUNK_WIDTH ) as i32 ;
271
+ let biomes_per_section = biome_coords:: from_block ( CHUNK_DIM ) as i32 ;
270
272
for x in 0 ..biomes_per_section {
271
273
for y in 0 ..biomes_per_section {
272
274
for z in 0 ..biomes_per_section {
@@ -300,7 +302,7 @@ impl<'a> ProtoChunk<'a> {
300
302
let horizontal_cell_block_count = self . noise_sampler . horizontal_cell_block_count ( ) ;
301
303
let vertical_cell_block_count = self . noise_sampler . vertical_cell_block_count ( ) ;
302
304
303
- let horizontal_cells = ( CHUNK_WIDTH / horizontal_cell_block_count as usize ) as u8 ;
305
+ let horizontal_cells = ( CHUNK_DIM / horizontal_cell_block_count) as u8 ;
304
306
305
307
let min_y = self . noise_sampler . min_y ( ) ;
306
308
let minimum_cell_y = min_y / vertical_cell_block_count as i8 ;
0 commit comments