1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00
This commit is contained in:
mat 2024-04-20 04:03:03 +00:00
parent 6d9d1a4569
commit 8a1e1b7bb9
7 changed files with 10 additions and 22 deletions

View file

@ -63,7 +63,7 @@ impl<'a, S> CommandContextBuilder<'a, S> {
} }
pub fn with_command(&mut self, command: &Command<S>) -> &Self { pub fn with_command(&mut self, command: &Command<S>) -> &Self {
self.command = command.clone(); self.command.clone_from(command);
self self
} }
pub fn with_child(&mut self, child: Rc<CommandContextBuilder<'a, S>>) -> &Self { pub fn with_child(&mut self, child: Rc<CommandContextBuilder<'a, S>>) -> &Self {
@ -80,7 +80,7 @@ impl<'a, S> CommandContextBuilder<'a, S> {
range, range,
}); });
self.range = StringRange::encompassing(&self.range, &range); self.range = StringRange::encompassing(&self.range, &range);
self.modifier = node.read().modifier.clone(); self.modifier.clone_from(&node.read().modifier);
self.forks = node.read().forks; self.forks = node.read().forks;
self self
} }

View file

@ -41,7 +41,7 @@ impl McBufVarWritable for i32 {
} }
while value != 0 { while value != 0 {
buffer[0] = (value & 0b0111_1111) as u8; buffer[0] = (value & 0b0111_1111) as u8;
value = (value >> 7) & (i32::max_value() >> 6); value = (value >> 7) & (i32::MAX >> 6);
if value != 0 { if value != 0 {
buffer[0] |= 0b1000_0000; buffer[0] |= 0b1000_0000;
} }
@ -137,7 +137,7 @@ impl McBufVarWritable for i64 {
} }
while value != 0 { while value != 0 {
buffer[0] = (value & 0b0111_1111) as u8; buffer[0] = (value & 0b0111_1111) as u8;
value = (value >> 7) & (i64::max_value() >> 6); value = (value >> 7) & (i64::MAX >> 6);
if value != 0 { if value != 0 {
buffer[0] |= 0b1000_0000; buffer[0] |= 0b1000_0000;
} }

View file

@ -557,7 +557,7 @@ pub fn process_packet_events(ecs: &mut World) {
info.latency = updated_info.latency; info.latency = updated_info.latency;
} }
if p.actions.update_display_name { if p.actions.update_display_name {
info.display_name = updated_info.display_name.clone(); info.display_name.clone_from(&updated_info.display_name);
} }
update_player_events.send(UpdatePlayerEvent { update_player_events.send(UpdatePlayerEvent {
entity: player_entity, entity: player_entity,

View file

@ -58,7 +58,7 @@ impl Default for TaskPoolOptions {
TaskPoolOptions { TaskPoolOptions {
// By default, use however many cores are available on the system // By default, use however many cores are available on the system
min_total_threads: 1, min_total_threads: 1,
max_total_threads: std::usize::MAX, max_total_threads: usize::MAX,
// Use 25% of cores for IO, at least 1, no more than 4 // Use 25% of cores for IO, at least 1, no more than 4
io: TaskPoolThreadAssignmentPolicy { io: TaskPoolThreadAssignmentPolicy {
@ -77,7 +77,7 @@ impl Default for TaskPoolOptions {
// Use all remaining cores for compute (at least 1) // Use all remaining cores for compute (at least 1)
compute: TaskPoolThreadAssignmentPolicy { compute: TaskPoolThreadAssignmentPolicy {
min_threads: 1, min_threads: 1,
max_threads: std::usize::MAX, max_threads: usize::MAX,
percent: 1.0, // This 1.0 here means "whatever is left over" percent: 1.0, // This 1.0 here means "whatever is left over"
}, },
} }

View file

@ -323,7 +323,7 @@ impl Shapes {
coords: coords1.to_vec(), coords: coords1.to_vec(),
} }
} else { } else {
IndexMerger::new_indirect(&coords1, &coords2, var3, var4) IndexMerger::new_indirect(coords1, coords2, var3, var4)
} }
} }
} }

View file

@ -85,7 +85,6 @@ pub struct BlockCollisionsState<'a> {
pub aabb: AABB, pub aabb: AABB,
pub entity_shape: VoxelShape, pub entity_shape: VoxelShape,
pub cursor: Cursor3d, pub cursor: Cursor3d,
pub only_suffocating_blocks: bool,
cached_sections: Vec<(ChunkSectionPos, azalea_world::Section)>, cached_sections: Vec<(ChunkSectionPos, azalea_world::Section)>,
cached_block_shapes: Vec<(BlockState, &'static VoxelShape)>, cached_block_shapes: Vec<(BlockState, &'static VoxelShape)>,
@ -112,7 +111,6 @@ impl<'a> BlockCollisionsState<'a> {
aabb, aabb,
entity_shape: VoxelShape::from(aabb), entity_shape: VoxelShape::from(aabb),
cursor, cursor,
only_suffocating_blocks: false,
cached_sections: Vec::new(), cached_sections: Vec::new(),
cached_block_shapes: Vec::new(), cached_block_shapes: Vec::new(),

View file

@ -1,20 +1,10 @@
use std::{hint::black_box, sync::Arc, time::Duration};
use azalea::{ use azalea::{
pathfinder::{ pathfinder::simulation::{SimulatedPlayerBundle, SimulationSet},
astar::{self, a_star}, Vec3,
goals::{BlockPosGoal, Goal},
mining::MiningCache,
simulation::{SimulatedPlayerBundle, Simulation, SimulationSet},
world::CachedWorld,
},
BlockPos, Vec3,
}; };
use azalea_core::position::{ChunkBlockPos, ChunkPos}; use azalea_core::position::{ChunkBlockPos, ChunkPos};
use azalea_inventory::Menu;
use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage}; use azalea_world::{Chunk, ChunkStorage, PartialChunkStorage};
use criterion::{criterion_group, criterion_main, Bencher, Criterion}; use criterion::{criterion_group, criterion_main, Bencher, Criterion};
use parking_lot::RwLock;
#[allow(dead_code)] #[allow(dead_code)]
fn generate_world(partial_chunks: &mut PartialChunkStorage, size: u32) -> ChunkStorage { fn generate_world(partial_chunks: &mut PartialChunkStorage, size: u32) -> ChunkStorage {