Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2,860 changes: 2,125 additions & 735 deletions Cargo.lock

Large diffs are not rendered by default.

25 changes: 15 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,23 @@ split-debuginfo = "unpacked"
opt-level = 1

[dependencies]
winit = { version = "0.29", features = ["rwh_05", "serde"] }
raw-window-handle = "0.5.0"
glow = "0.13"
winit = { version = "0.30", features = ["rwh_06", "serde"] }
raw-window-handle = "0.6.0"

# wgpu-mc renderer (optional, enable with --features wgpu-mc)
wgpu-mc = { path = "/opt/3d/minecraft/wgpu-mc/rust/wgpu-mc", optional = true }
futures = { version = "0.3", optional = true }
glam = { version = "0.29", optional = true }
glow = "0.17"
byteorder = "1.4"
serde = { version = "1.0", features = ["derive"] }
serde_json = "1.0"
flate2 = { version = "1.0", features = ["rust_backend"], default-features = false }
zip = { version = "0.6", features = ["deflate"], default-features = false }
image = "0.25"
getrandom = { version = "0.2", features = ["js"] }
rand = "0.8"
rand_pcg = "0.3"
getrandom = { version = "0.3", features = ["wasm_js"] }
rand = "0.9"
rand_pcg = "0.9"
base64 = "0.22"
log = { version = "0.4", features = ["std"] }
cgmath = "0.17"
Expand All @@ -55,13 +60,13 @@ crossbeam-channel = "0.5" # check if flume would be better in terms of performan
# flume = "0.10.8" # replaced by crossbeam channel
# tokio = { version = "0.2", features = ["full"] } # readd as soon as we want to impl this!
rayon = "1.5"
rfd = "0.14"
bevy_ecs = "0.13"
rfd = "0.17"
bevy_ecs = "0.15"

reqwest = { version = "0.11", features = [ "blocking" ]}
# glutin = "0.29"
glutin = "0.31"
glutin-winit = "0.4"
glutin = "0.32"
glutin-winit = "0.5"

arc-swap = "1.7.0"
# phf = "0.11"
Expand Down
6 changes: 3 additions & 3 deletions protocol/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@ lazy_static = "1.4.0"
trust-dns-resolver = "0.23"
# srv-rs = { version = "0.2.0", features = ["libresolv"] }

dashmap = "5.5"
dashmap = "6.1"

bevy_ecs = "0.13"
bevy_ecs = "0.15"

reqwest = { version = "0.11", features = [ "blocking" ]}
reqwest = { version = "0.12", features = [ "blocking" ]}

[dependencies.leafish_shared]
path = "../shared"
Expand Down
2 changes: 1 addition & 1 deletion shared/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ authors = [ "Thinkofdeath <thinkofdeath@spigotmc.org>" ]
edition = "2018"

[dependencies]
bevy_ecs = "0.13"
bevy_ecs = "0.15"
2 changes: 1 addition & 1 deletion src/chunk_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ fn build_func_1(models: Arc<RwLock<model::Factory>>, work: BuildReq) -> BuildRep
// Use one step of the rng so that
// if a block is placed in an empty
// location is variant doesn't change
let _: u32 = rng.gen();
let _: u32 = rng.random();
continue;
}

Expand Down
12 changes: 6 additions & 6 deletions src/gl/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ impl Texture {
pixels: &mut [u8],
) {
unsafe {
glow_context().get_tex_image(target, level, format, ty, PixelPackData::Slice(pixels));
glow_context().get_tex_image(target, level, format, ty, PixelPackData::Slice(Some(pixels)));
}
}

Expand All @@ -317,7 +317,7 @@ impl Texture {
0,
format,
ty,
pix,
PixelUnpackData::Slice(pix),
);
}
}
Expand All @@ -344,7 +344,7 @@ impl Texture {
height as i32,
format,
ty,
PixelUnpackData::Slice(pix),
PixelUnpackData::Slice(Some(pix)),
);
}
}
Expand All @@ -370,7 +370,7 @@ impl Texture {
0,
format,
ty,
pix,
PixelUnpackData::Slice(pix),
);
}
}
Expand All @@ -397,7 +397,7 @@ impl Texture {
0,
format,
ty,
Some(pix),
PixelUnpackData::Slice(Some(pix)),
);
}
}
Expand Down Expand Up @@ -428,7 +428,7 @@ impl Texture {
depth as i32,
format,
ty,
PixelUnpackData::Slice(pix),
PixelUnpackData::Slice(Some(pix)),
);
}
}
Expand Down
12 changes: 7 additions & 5 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ use glutin_winit::GlWindow;
use instant::Duration;
use leafish_protocol::protocol::login::AccountType;
use log::{debug, error, info, warn};
use raw_window_handle::HasRawWindowHandle;
use raw_window_handle::HasWindowHandle;
use shared::Version;
use std::fs;
use std::num::NonZeroU32;
Expand Down Expand Up @@ -339,7 +339,7 @@ fn main() {

let events_loop = winit::event_loop::EventLoop::new().unwrap();

let window_builder = winit::window::WindowBuilder::new()
let window_attributes = winit::window::Window::default_attributes()
.with_title("Leafish")
.with_window_icon(Some(
Icon::from_rgba(
Expand All @@ -360,15 +360,17 @@ fn main() {
.with_stencil_size(0)
.with_depth_size(24)
.with_api(Api::GLES3.union(Api::OPENGL));
let display_builder = DisplayBuilder::new().with_window_builder(Some(window_builder));
let display_builder = DisplayBuilder::new().with_window_attributes(Some(window_attributes));

let (window, gl_config) = display_builder
.build(&events_loop, template, |mut configs| {
configs.next().unwrap()
})
.unwrap();

let raw_window_handle = window.as_ref().map(|window| window.raw_window_handle());
let raw_window_handle = window
.as_ref()
.map(|window| window.window_handle().unwrap().as_raw());
let gl_display = gl_config.display();
let context_attributes = ContextAttributesBuilder::new().build(raw_window_handle);

Expand All @@ -393,7 +395,7 @@ fn main() {

let window = window.unwrap();

let attrs = window.build_surface_attributes(Default::default());
let attrs = window.build_surface_attributes(Default::default()).unwrap();
let gl_surface = unsafe {
gl_config
.display()
Expand Down
2 changes: 1 addition & 1 deletion src/model/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use std::hash::BuildHasherDefault;

use image::GenericImageView;
use parking_lot::RwLock;
use rand::seq::SliceRandom;
use rand::seq::IndexedRandom;
use rand::Rng;

pub struct Factory {
Expand Down
4 changes: 2 additions & 2 deletions src/render/hud.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ use std::time::{SystemTime, UNIX_EPOCH};
use leafish_protocol::format::Component;
use log::debug;
use parking_lot::RwLock;
use rand::{thread_rng, Rng};
use rand::Rng;
use winit::keyboard::{Key, NamedKey, PhysicalKey};

use crate::inventory::slot_mapping::SlotMapping;
Expand Down Expand Up @@ -589,7 +589,7 @@ impl Hud {

if hp <= 4.0 {
// Creates the jittery effect when player has less than 2.5 hearts
y += icon_scale * (thread_rng().gen_range(0..2) as f64);
y += icon_scale * (rand::rng().random_range(0..2) as f64);
redirty_health = true;
}

Expand Down
2 changes: 1 addition & 1 deletion src/screen/launcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl super::Screen for Launcher {
if client_token.is_empty() {
client_token = std::iter::repeat(())
.map(|()| {
rand::thread_rng().sample(rand::distributions::Alphanumeric) as char
rand::rng().sample(rand::distr::Alphanumeric) as char
})
.take(20)
.collect();
Expand Down
4 changes: 2 additions & 2 deletions src/screen/login.rs
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ impl super::Screen for Login {
// Generate random token if it wasn't supplied
if client_token.is_empty() {
client_token = std::iter::repeat(())
.map(|()| rand::thread_rng().sample(rand::distributions::Alphanumeric) as char)
.map(|()| rand::rng().sample(rand::distr::Alphanumeric) as char)
.take(20)
.collect();
self.settings
Expand All @@ -231,7 +231,7 @@ impl super::Screen for Login {
tx.send(try_login(
refresh,
if username.is_empty() {
format!("Player{}", rand::thread_rng().gen::<u8>())
format!("Player{}", rand::rng().random::<u8>())
} else {
username
},
Expand Down
2 changes: 1 addition & 1 deletion src/screen/server_list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -628,7 +628,7 @@ impl super::Screen for ServerList {
if let Some(favicon) = res.favicon {
let name: String = std::iter::repeat(())
.map(|()| {
rand::thread_rng().sample(rand::distributions::Alphanumeric)
rand::rng().sample(rand::distr::Alphanumeric)
as char
})
.take(30)
Expand Down
8 changes: 4 additions & 4 deletions src/server/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ impl Server {
}

let mut shared = [0; 16];
rand::thread_rng().fill(&mut shared);
rand::rng().fill(&mut shared);

let shared_e = rsa_public_encrypt_pkcs1::encrypt(&public_key, &shared).unwrap();
let token_e = rsa_public_encrypt_pkcs1::encrypt(&public_key, &verify_token).unwrap();
Expand Down Expand Up @@ -989,7 +989,7 @@ impl Server {
self.entities.write().world.despawn(player.1);
}
for entity in &*self.entity_map.write() {
if self.entities.read().world.get_entity(*entity.1).is_some() {
if self.entities.read().world.get_entity(*entity.1).is_ok() {
self.entities.write().world.despawn(*entity.1);
}
}
Expand All @@ -1009,7 +1009,7 @@ impl Server {
self.entities.write().world.despawn(player.1);
}
for entity in &*self.entity_map.write() {
if self.entities.read().world.get_entity(*entity.1).is_some() {
if self.entities.read().world.get_entity(*entity.1).is_ok() {
self.entities.write().world.despawn(*entity.1);
}
}
Expand Down Expand Up @@ -1801,7 +1801,7 @@ impl Server {
} = respawn;

for entity in &*self.entity_map.write() {
if self.entities.read().world.get_entity(*entity.1).is_some() {
if self.entities.read().world.get_entity(*entity.1).is_ok() {
self.entities.write().world.despawn(*entity.1);
}
}
Expand Down
17 changes: 8 additions & 9 deletions src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@

use arc_swap::ArcSwap;
use bevy_ecs::entity::Entity;
use bevy_ecs::system::{Command, Commands};
use bevy_ecs::system::Commands;
use bevy_ecs::world::Command;
pub use leafish_blocks as block;
use leafish_protocol::format::Component;
use leafish_protocol::nbt::NamedTag;
Expand Down Expand Up @@ -273,7 +274,7 @@ impl World {
let (pos, line1, line2, line3, line4) = *bx;
if let Some(chunk) = self.chunks.write().get(&CPos(pos.x >> 4, pos.z >> 4)) {
if let Some(entity) = chunk.block_entities.get(&pos) {
cmds.add(UpdateSignInfoCmd([line1, line2, line3, line4], *entity));
cmds.queue(UpdateSignInfoCmd([line1, line2, line3, line4], *entity));
}
}
}
Expand Down Expand Up @@ -1478,13 +1479,11 @@ struct UpdateSignInfoCmd([Component; 4], Entity);

impl Command for UpdateSignInfoCmd {
fn apply(self, world: &mut bevy_ecs::world::World) {
let mut entity = world.get_entity_mut(self.1);
if let Some(mut info) = entity
.as_mut()
.and_then(|entity| entity.get_mut::<SignInfo>())
{
info.lines.clone_from(&self.0);
info.dirty = true;
if let Ok(mut entity) = world.get_entity_mut(self.1) {
if let Some(mut info) = entity.get_mut::<SignInfo>() {
info.lines.clone_from(&self.0);
info.dirty = true;
}
}
}
}
Expand Down