mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 14:31:30 +11:00
Remove remaining unnecessary casts in examples
This commit is contained in:
parent
985f7891e4
commit
4e302ca09f
|
@ -86,7 +86,7 @@ impl Config for Game {
|
|||
for chunk_z in -2..Integer::div_ceil(&(SIZE_Z as i32), &16) + 2 {
|
||||
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||
world.chunks.insert(
|
||||
[chunk_x as i32, chunk_z as i32],
|
||||
[chunk_x, chunk_z],
|
||||
UnloadedChunk::default(),
|
||||
(),
|
||||
);
|
||||
|
|
|
@ -90,11 +90,9 @@ impl Config for Game {
|
|||
|
||||
for chunk_z in -2..Integer::div_ceil(&(SIZE_Z as i32), &16) + 2 {
|
||||
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||
world.chunks.insert(
|
||||
[chunk_x as i32, chunk_z as i32],
|
||||
UnloadedChunk::default(),
|
||||
(),
|
||||
);
|
||||
world
|
||||
.chunks
|
||||
.insert([chunk_x, chunk_z], UnloadedChunk::default(), ());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -267,10 +265,7 @@ impl Config for Game {
|
|||
|
||||
for chunk_x in 0..Integer::div_ceil(&SIZE_X, &16) {
|
||||
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
||||
let chunk = world
|
||||
.chunks
|
||||
.get_mut((chunk_x as i32, chunk_z as i32))
|
||||
.unwrap();
|
||||
let chunk = world.chunks.get_mut([chunk_x, chunk_z]).unwrap();
|
||||
for x in 0..16 {
|
||||
for z in 0..16 {
|
||||
let cell_x = chunk_x * 16 + x;
|
||||
|
|
|
@ -78,21 +78,16 @@ impl Config for Game {
|
|||
// initialize chunks
|
||||
for chunk_z in -2..Integer::div_ceil(&(SIZE_Z as i32), &16) + 2 {
|
||||
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||
world.chunks.insert(
|
||||
[chunk_x as i32, chunk_z as i32],
|
||||
UnloadedChunk::default(),
|
||||
(),
|
||||
);
|
||||
world
|
||||
.chunks
|
||||
.insert([chunk_x, chunk_z], UnloadedChunk::default(), ());
|
||||
}
|
||||
}
|
||||
|
||||
// initialize blocks in the chunks
|
||||
for chunk_x in 0..Integer::div_ceil(&SIZE_X, &16) {
|
||||
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
||||
let chunk = world
|
||||
.chunks
|
||||
.get_mut((chunk_x as i32, chunk_z as i32))
|
||||
.unwrap();
|
||||
let chunk = world.chunks.get_mut([chunk_x, chunk_z]).unwrap();
|
||||
for x in 0..16 {
|
||||
for z in 0..16 {
|
||||
let cell_x = chunk_x * 16 + x;
|
||||
|
|
|
@ -257,7 +257,7 @@ fn reset(client: &mut Client<Game>, world: &mut World<Game>) {
|
|||
for chunk_z in -1..3 {
|
||||
for chunk_x in -2..2 {
|
||||
world.chunks.insert(
|
||||
(chunk_x, chunk_z),
|
||||
[chunk_x, chunk_z],
|
||||
UnloadedChunk::default(),
|
||||
ChunkState { keep_loaded: true },
|
||||
);
|
||||
|
|
Loading…
Reference in a new issue