1
2
Fork 0
mirror of https://github.com/mat-1/azalea.git synced 2025-08-02 14:26:04 +00:00

fix chunks oops

This commit is contained in:
mat 2025-02-21 19:41:39 +00:00
parent 541325289b
commit cb00686273
4 changed files with 8 additions and 5 deletions

View file

@ -8,6 +8,7 @@ use std::{
time::{Duration, Instant}, time::{Duration, Instant},
}; };
use azalea_core::position::ChunkPos;
use azalea_protocol::packets::game::{ use azalea_protocol::packets::game::{
c_level_chunk_with_light::ClientboundLevelChunkWithLight, c_level_chunk_with_light::ClientboundLevelChunkWithLight,
s_chunk_batch_received::ServerboundChunkBatchReceived, s_chunk_batch_received::ServerboundChunkBatchReceived,
@ -75,7 +76,7 @@ pub fn handle_receive_chunk_events(
mut query: Query<&mut InstanceHolder>, mut query: Query<&mut InstanceHolder>,
) { ) {
for event in events.read() { for event in events.read() {
let pos = event.packet.pos; let pos = ChunkPos::new(event.packet.x, event.packet.z);
let local_player = query.get_mut(event.entity).unwrap(); let local_player = query.get_mut(event.entity).unwrap();

View file

@ -604,7 +604,7 @@ pub fn process_packet_events(ecs: &mut World) {
// debug!("Got light update packet {p:?}"); // debug!("Got light update packet {p:?}");
} }
ClientboundGamePacket::LevelChunkWithLight(p) => { ClientboundGamePacket::LevelChunkWithLight(p) => {
debug!("Got chunk with light packet {:?}", p.pos); debug!("Got chunk with light packet {} {}", p.x, p.z);
let mut system_state: SystemState<EventWriter<chunks::ReceiveChunkEvent>> = let mut system_state: SystemState<EventWriter<chunks::ReceiveChunkEvent>> =
SystemState::new(ecs); SystemState::new(ecs);

View file

@ -253,7 +253,8 @@ pub fn make_basic_empty_chunk(
sections.azalea_write(&mut chunk_bytes).unwrap(); sections.azalea_write(&mut chunk_bytes).unwrap();
ClientboundLevelChunkWithLight { ClientboundLevelChunkWithLight {
pos, x: pos.x,
z: pos.z,
chunk_data: ClientboundLevelChunkPacketData { chunk_data: ClientboundLevelChunkPacketData {
heightmaps: Nbt::None, heightmaps: Nbt::None,
data: chunk_bytes, data: chunk_bytes,

View file

@ -1,5 +1,4 @@
use azalea_buf::AzBuf; use azalea_buf::AzBuf;
use azalea_core::position::ChunkPos;
use azalea_protocol_macros::ClientboundGamePacket; use azalea_protocol_macros::ClientboundGamePacket;
use simdnbt::owned::Nbt; use simdnbt::owned::Nbt;
@ -7,7 +6,9 @@ use super::c_light_update::ClientboundLightUpdatePacketData;
#[derive(Clone, Debug, AzBuf, ClientboundGamePacket)] #[derive(Clone, Debug, AzBuf, ClientboundGamePacket)]
pub struct ClientboundLevelChunkWithLight { pub struct ClientboundLevelChunkWithLight {
pub pos: ChunkPos, // this can't be a ChunkPos since that reads z first and then x
pub x: i32,
pub z: i32,
pub chunk_data: ClientboundLevelChunkPacketData, pub chunk_data: ClientboundLevelChunkPacketData,
pub light_data: ClientboundLightUpdatePacketData, pub light_data: ClientboundLightUpdatePacketData,
} }