mirror of
https://github.com/Pumpkin-MC/Pumpkin.git
synced 2026-08-30 20:14:23 +00:00
fix(world): correctly use random tick speed gamerule value (#2904)
Signed-off-by: Cayden Tisdale <73692034+Phoenixxo@users.noreply.github.com>
This commit is contained in:
@@ -498,7 +498,13 @@ impl Level {
|
||||
});
|
||||
}
|
||||
|
||||
pub fn get_tick_data(&self, active_chunks: &FxHashSet<Vector2<i32>>) -> TickData {
|
||||
pub fn get_tick_data(
|
||||
&self,
|
||||
active_chunks: &FxHashSet<Vector2<i32>>,
|
||||
random_tick_speed: i64,
|
||||
) -> TickData {
|
||||
let samples_per_section = random_tick_speed.max(0);
|
||||
|
||||
let mut ticks = TickData {
|
||||
block_ticks: Vec::new(),
|
||||
fluid_ticks: Vec::new(),
|
||||
@@ -528,7 +534,7 @@ impl Level {
|
||||
continue;
|
||||
}
|
||||
let y_base = min_y + (i as i32 * 16);
|
||||
for _ in 0..3 {
|
||||
for _ in 0..samples_per_section {
|
||||
let r = rand::random::<u32>();
|
||||
let x_offset = (r & 0xF) as usize;
|
||||
let z_offset = (r >> 8 & 0xF) as usize;
|
||||
|
||||
@@ -1640,9 +1640,10 @@ impl World {
|
||||
#[expect(clippy::too_many_lines)]
|
||||
pub fn tick_chunks(self: &Arc<Self>, server: &Arc<Server>) {
|
||||
const BATCH_SIZE: usize = 32;
|
||||
let random_tick_speed = self.level_info.load().game_rules.random_tick_speed;
|
||||
|
||||
let active_chunks = self.active_chunks.load();
|
||||
let tick_data = self.level.get_tick_data(&active_chunks);
|
||||
let tick_data = self.level.get_tick_data(&active_chunks, random_tick_speed);
|
||||
let handle = server.runtime.clone();
|
||||
|
||||
// 1. Parallel Block Ticks via Rayon
|
||||
|
||||
Reference in New Issue
Block a user