mirror of
https://github.com/italicsjenga/valence.git
synced 2024-12-23 22:41: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_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 {
|
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||||
world.chunks.insert(
|
world.chunks.insert(
|
||||||
[chunk_x as i32, chunk_z as i32],
|
[chunk_x, chunk_z],
|
||||||
UnloadedChunk::default(),
|
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_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 {
|
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||||
world.chunks.insert(
|
world
|
||||||
[chunk_x as i32, chunk_z as i32],
|
.chunks
|
||||||
UnloadedChunk::default(),
|
.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_x in 0..Integer::div_ceil(&SIZE_X, &16) {
|
||||||
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
||||||
let chunk = world
|
let chunk = world.chunks.get_mut([chunk_x, chunk_z]).unwrap();
|
||||||
.chunks
|
|
||||||
.get_mut((chunk_x as i32, chunk_z as i32))
|
|
||||||
.unwrap();
|
|
||||||
for x in 0..16 {
|
for x in 0..16 {
|
||||||
for z in 0..16 {
|
for z in 0..16 {
|
||||||
let cell_x = chunk_x * 16 + x;
|
let cell_x = chunk_x * 16 + x;
|
||||||
|
|
|
@ -78,21 +78,16 @@ impl Config for Game {
|
||||||
// initialize chunks
|
// initialize chunks
|
||||||
for chunk_z in -2..Integer::div_ceil(&(SIZE_Z as i32), &16) + 2 {
|
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 {
|
for chunk_x in -2..Integer::div_ceil(&(SIZE_X as i32), &16) + 2 {
|
||||||
world.chunks.insert(
|
world
|
||||||
[chunk_x as i32, chunk_z as i32],
|
.chunks
|
||||||
UnloadedChunk::default(),
|
.insert([chunk_x, chunk_z], UnloadedChunk::default(), ());
|
||||||
(),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// initialize blocks in the chunks
|
// initialize blocks in the chunks
|
||||||
for chunk_x in 0..Integer::div_ceil(&SIZE_X, &16) {
|
for chunk_x in 0..Integer::div_ceil(&SIZE_X, &16) {
|
||||||
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
for chunk_z in 0..Integer::div_ceil(&SIZE_Z, &16) {
|
||||||
let chunk = world
|
let chunk = world.chunks.get_mut([chunk_x, chunk_z]).unwrap();
|
||||||
.chunks
|
|
||||||
.get_mut((chunk_x as i32, chunk_z as i32))
|
|
||||||
.unwrap();
|
|
||||||
for x in 0..16 {
|
for x in 0..16 {
|
||||||
for z in 0..16 {
|
for z in 0..16 {
|
||||||
let cell_x = chunk_x * 16 + x;
|
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_z in -1..3 {
|
||||||
for chunk_x in -2..2 {
|
for chunk_x in -2..2 {
|
||||||
world.chunks.insert(
|
world.chunks.insert(
|
||||||
(chunk_x, chunk_z),
|
[chunk_x, chunk_z],
|
||||||
UnloadedChunk::default(),
|
UnloadedChunk::default(),
|
||||||
ChunkState { keep_loaded: true },
|
ChunkState { keep_loaded: true },
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue