Skip to content

Commit ad90fed

Browse files
authored
Merge branch 'master' into whitelist-new
2 parents 450d656 + 4178621 commit ad90fed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1607
-614
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,5 @@ flame.svg
1616
.direnv
1717
result
1818
result-*
19+
20+
profile.json.gz

Cargo.toml

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ members = [
3434
"src/lib/world",
3535
"src/lib/world_gen",
3636
"src/lib/utils/threadpool",
37+
"src/lib/registry",
3738
]
3839

3940
#================== Lints ==================#
4041
[workspace.lints.rust]
41-
unsafe_code = "deny"
42+
unsafe_code = "allow"
4243
unused_unsafe = "deny"
4344
#unsafe_op_in_unsafe_fn = "deny"
4445
#unused_crate_dependencies = "deny"
@@ -96,17 +97,18 @@ ferrumc-net-codec = { path = "src/lib/net/crates/codec" }
9697
ferrumc-net-encryption = { path = "src/lib/net/crates/encryption" }
9798
ferrumc-plugins = { path = "src/lib/plugins" }
9899
ferrumc-profiling = { path = "src/lib/utils/profiling" }
100+
ferrumc-registry = { path = "src/lib/registry" }
99101
ferrumc-state = { path = "src/lib/core/state" }
100102
ferrumc-storage = { path = "src/lib/storage" }
101103
ferrumc-text = { path = "src/lib/text" }
104+
ferrumc-threadpool = { path = "src/lib/utils/threadpool" }
102105
ferrumc-utils = { path = "src/lib/utils" }
103106
ferrumc-world = { path = "src/lib/world" }
104107
ferrumc-world-gen = { path = "src/lib/world_gen" }
105-
ferrumc-threadpool = { path = "src/lib/utils/threadpool" }
106108

107109

108110
# Asynchronous
109-
tokio = { version = "1.45.1", features = ["full"] }
111+
tokio = { version = "1.47.1", features = ["macros", "net", "rt", "sync", "time", "io-util", "test-util"], default-features = false }
110112

111113
# Logging
112114
tracing = "0.1.41"
@@ -123,42 +125,44 @@ rusty_pool = "0.7.0"
123125
crossbeam-queue = "0.3.12"
124126

125127
# Network
126-
reqwest = { version = "0.12.19", features = ["json"] }
127-
ureq = "3.0.11"
128+
reqwest = { version = "0.12.22", features = ["json"] }
129+
ureq = "3.0.12"
128130

129131
# Error handling
130132
thiserror = "2.0.12"
131133

132134
# Cryptography
133-
rand = "0.9.1"
135+
rand = "0.9.2"
134136
fnv = "1.0.7"
135137
wyhash = "0.6.0"
136138
ahash = "0.8.12"
137139

138140
# Encoding/Serialization
139141
serde = { version = "1.0.219", features = ["derive"] }
140-
serde_json = "1.0.140"
142+
serde_json = "1.0.142"
141143
serde_derive = "1.0.219"
142144
serde_yaml_ng = "0.9.36"
143145
base64 = "0.22.1"
144146
bitcode = "0.6.6"
145147
bitcode_derive = "0.6.5"
146-
toml = "0.8.23"
148+
toml = "0.9.4"
147149
craftflow-nbt = "2.1.0"
148150
figment = { version = "0.10.19", features = ["toml", "env"] }
151+
simd-json = "0.15.1"
152+
sonic-rs = "0.5.3"
149153

150154
# Bit manipulation
151155
byteorder = "1.5.0"
152156

153157
# Data types
154158
dashmap = "7.0.0-rc2"
155159
uuid = { version = "1.17.0", features = ["v4", "v3", "serde"] }
156-
indexmap = { version = "2.9.0", features = ["serde"] }
160+
indexmap = { version = "2.10.0", features = ["serde"] }
157161

158162
# Macros
159163
lazy_static = "1.5.0"
160164
quote = "1.0.40"
161-
syn = "2.0.102"
165+
syn = "2.0.104"
162166
proc-macro2 = "1.0.95"
163167
proc-macro-crate = "3.3.0"
164168
paste = "1.0.15"
@@ -172,15 +176,16 @@ dhat = "0.3.3"
172176
flate2 = { version = "1.1.2", features = ["zlib"], default-features = false }
173177
lzzzz = "2.0.0"
174178
yazi = "0.2.1"
175-
bzip2 = "0.5.2"
179+
bzip2 = "0.6.0"
180+
lz4_flex = "0.11.5"
176181

177182
# Database
178183
heed = "0.22.0"
179184
moka = "0.12.10"
180185

181186
# CLI
182-
clap = "4.5.40"
183-
indicatif = "0.17.11"
187+
clap = "4.5.42"
188+
indicatif = "0.18.0"
184189
colored = "3.0.0"
185190

186191
# Misc
@@ -195,8 +200,8 @@ bevy_ecs = { version = "0.16.1", features = ["multi_threaded", "trace"] }
195200
once_cell = "1.21.3"
196201

197202
# I/O
198-
memmap2 = "0.9.5"
203+
memmap2 = "0.9.7"
199204
tempfile = "3.20.0"
200205

201206
# Benchmarking
202-
criterion = { version = "0.6.0", features = ["html_reports"] }
207+
criterion = { version = "0.7.0", features = ["html_reports"] }

assets/data/configs/main-config.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ whitelist = false
1717
# Set to -1 to disable compression.
1818
network_compression_threshold = 64
1919

20+
# Verify decompressed packets. This is a good idea to catch any corruption, but it will slow down processing.
21+
verify_decompressed_packets = true
22+
2023
# Chunk render distance. This is the distance in chunks that the server will load around the player.
2124
chunk_render_distance = 12
2225

src/bin/src/main.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,7 @@ fn handle_import(import_args: ImportArgs) -> Result<(), BinaryError> {
146146
import_path = root_path.join(import_path);
147147
}
148148

149-
if let Err(e) = world.import(
150-
import_path,
151-
import_args.batch_size,
152-
// import_args.max_concurrent_tasks,
153-
) {
149+
if let Err(e) = world.import(import_path, ThreadPool::new()) {
154150
error!("Could not import world: {}", e.to_string());
155151
return Err(BinaryError::Custom("Could not import world.".to_string()));
156152
}

src/bin/src/packet_handlers/play_packets/place_block.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ pub fn handle(
9191
let packet = BlockChangeAck {
9292
sequence: event.sequence,
9393
};
94-
conn.send_packet(&packet)?;
94+
conn.send_packet_ref(&packet)?;
9595

9696
chunk.set_block(x & 0xF, y as i32, z & 0xF, DUMMY_BLOCK)?;
9797
let ack_packet = BlockChangeAck {
@@ -102,8 +102,8 @@ pub fn handle(
102102
location: NetworkPosition { x, y, z },
103103
block_id: VarInt::from(DUMMY_BLOCK),
104104
};
105-
conn.send_packet(&chunk_packet)?;
106-
conn.send_packet(&ack_packet)?;
105+
conn.send_packet_ref(&chunk_packet)?;
106+
conn.send_packet_ref(&ack_packet)?;
107107

108108
state.0.world.save_chunk(Arc::new(chunk))?;
109109
}

src/bin/src/packet_handlers/play_packets/player_action.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,12 +54,12 @@ pub fn handle(
5454
location: event.location.clone(),
5555
block_id: VarInt::from(BlockId::default()),
5656
};
57-
conn.send_packet(&block_update_packet)?;
57+
conn.send_packet_ref(&block_update_packet)?;
5858
if eid == trigger_eid {
5959
let ack_packet = BlockChangeAck {
6060
sequence: event.sequence,
6161
};
62-
conn.send_packet(&ack_packet)?;
62+
conn.send_packet_ref(&ack_packet)?;
6363
}
6464
}
6565
}

src/bin/src/packet_handlers/play_packets/player_command.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ pub fn handle(
2727
if !state.0.players.is_connected(entity) {
2828
continue;
2929
}
30-
if let Err(err) = conn.send_packet(&packet) {
30+
if let Err(err) = conn.send_packet_ref(&packet) {
3131
error!("Failed to send start sneaking packet: {:?}", err);
3232
}
3333
}
@@ -40,7 +40,7 @@ pub fn handle(
4040
if !state.0.players.is_connected(entity) {
4141
continue;
4242
}
43-
if let Err(err) = conn.send_packet(&packet) {
43+
if let Err(err) = conn.send_packet_ref(&packet) {
4444
error!("Failed to send stop sneaking packet: {:?}", err);
4545
}
4646
}

src/bin/src/packet_handlers/play_packets/player_loaded.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ pub fn handle(
5050
);
5151
// Teleport the player to the world center if their head block is not air
5252
let packet = SynchronizePlayerPositionPacket::default();
53-
if let Err(e) = conn.send_packet(&packet) {
53+
if let Err(e) = conn.send_packet_ref(&packet) {
5454
tracing::error!(
5555
"Failed to send synchronize player position packet for player {}: {:?}",
5656
player,

src/bin/src/packet_handlers/play_packets/set_player_position.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ pub fn handle(
2323
state: Res<GlobalStateResource>,
2424
) {
2525
for (event, eid) in events.0.try_iter() {
26+
if !state.0.players.is_connected(eid) {
27+
// Player is not connected, skip processing this event
28+
continue;
29+
}
2630
let new_rot = None::<Rotation>;
2731

2832
let new_position = Position::new(event.x, event.feet_y, event.z);
@@ -128,7 +132,7 @@ fn update_pos_for_all(
128132
if !state.players.is_connected(entity) {
129133
continue;
130134
}
131-
conn.send_packet(&packet)?;
135+
conn.send_packet_ref(&packet)?;
132136
}
133137

134138
Ok(())

src/bin/src/packet_handlers/play_packets/swing_arm.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ pub fn handle(
3030
if !state.0.players.is_connected(entity) {
3131
continue; // Skip if the player is not connected
3232
}
33-
if let Err(e) = conn.send_packet(&packet) {
33+
if let Err(e) = conn.send_packet_ref(&packet) {
3434
error!("Failed to send packet: {}", e);
3535
}
3636
}

0 commit comments

Comments
 (0)