diff --git a/Cargo.lock b/Cargo.lock index 8d5f03c1..0f74d331 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2048,7 +2048,7 @@ dependencies = [ [[package]] name = "flecs_ecs" version = "0.1.3" -source = "git+https://github.com/Indra-db/Flecs-Rust#42303387b3b03d791dc90139b2f57c787a37ce67" +source = "git+https://github.com/Indra-db/Flecs-Rust#9c7e8939a784b110c442f4f061fe46dc10fbb3cf" dependencies = [ "bitflags 2.9.0", "compact_str", @@ -2060,7 +2060,7 @@ dependencies = [ [[package]] name = "flecs_ecs_derive" version = "0.1.0" -source = "git+https://github.com/Indra-db/Flecs-Rust#42303387b3b03d791dc90139b2f57c787a37ce67" +source = "git+https://github.com/Indra-db/Flecs-Rust#9c7e8939a784b110c442f4f061fe46dc10fbb3cf" dependencies = [ "proc-macro2", "quote", @@ -2070,7 +2070,7 @@ dependencies = [ [[package]] name = "flecs_ecs_sys" version = "0.1.2" -source = "git+https://github.com/Indra-db/Flecs-Rust#42303387b3b03d791dc90139b2f57c787a37ce67" +source = "git+https://github.com/Indra-db/Flecs-Rust#9c7e8939a784b110c442f4f061fe46dc10fbb3cf" dependencies = [ "bindgen", "cc", @@ -3476,7 +3476,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fc2f4eb4bc735547cfed7c0a4922cbd04a4655978c09b54f1f7b228750664c34" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -6299,7 +6299,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "69fff37da548239c3bf9e64a12193d261e8b22b660991c6fd2df057c168f435f" dependencies = [ "cc", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] diff --git a/crates/hyperion-clap/src/lib.rs b/crates/hyperion-clap/src/lib.rs index 854a4852..1d5cd865 100644 --- a/crates/hyperion-clap/src/lib.rs +++ b/crates/hyperion-clap/src/lib.rs @@ -2,7 +2,7 @@ use std::iter::zip; use clap::{Arg as ClapArg, Parser, ValueEnum, ValueHint, error::ErrorKind}; use flecs_ecs::{ - core::{Entity, EntityView, EntityViewGet, World, WorldGet, WorldProvider}, + core::{Entity, EntityView, EntityViewGet, World, WorldGet, WorldProvider, id}, prelude::{Component, Module}, }; use hyperion::{ @@ -45,7 +45,7 @@ pub trait MinecraftCommand: Parser + CommandPermission { let mut on = world .entity() .set(node_to_register) - .child_of_id(get_root_command_entity()); + .child_of(get_root_command_entity()); for arg in cmd.get_arguments() { use valence_protocol::packets::play::command_tree_s2c::Parser as ValenceParser; @@ -56,7 +56,7 @@ pub trait MinecraftCommand: Parser + CommandPermission { ValenceParser::String(StringArg::SingleWord), ); - on = world.entity().set(node_to_register).child_of_id(on); + on = world.entity().set(node_to_register).child_of(on); } let on_execute = |input: &str, system: EntityView<'_>, caller: Entity| { @@ -315,7 +315,7 @@ impl MinecraftCommand for PermissionCommand { entity.entity_view(world).get::<&mut Group>(|group| { if *group != cmd.group { *group = cmd.group; - entity.entity_view(world).modified::(); + entity.entity_view(world).modified(id::()); } caller.entity_view(world).get::<&ConnectionId>(|stream| { diff --git a/crates/hyperion-permission/src/lib.rs b/crates/hyperion-permission/src/lib.rs index c0f94196..4afedc70 100644 --- a/crates/hyperion-permission/src/lib.rs +++ b/crates/hyperion-permission/src/lib.rs @@ -1,6 +1,6 @@ use clap::ValueEnum; use flecs_ecs::{ - core::{EntityViewGet, QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, WorldGet}, + core::{EntityViewGet, QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, WorldGet, id}, macros::{Component, observer}, prelude::{Module, flecs}, }; @@ -50,14 +50,14 @@ impl Module for PermissionModule { }); observer!(world, flecs::OnSet, &Uuid, &storage::PermissionStorage($)) - .with::() + .with(id::()) .each_entity(|entity, (uuid, permissions)| { let group = permissions.get(**uuid); entity.set(group); }); observer!(world, flecs::OnRemove, &Uuid, &Group, &storage::PermissionStorage($)) - .with::() + .with(id::()) .each(|(uuid, group, permissions)| { permissions.set(**uuid, *group).unwrap(); }); @@ -65,7 +65,7 @@ impl Module for PermissionModule { observer!(world, flecs::OnSet, &Group).each_iter(|it, row, _group| { let system = it.system(); let world = it.world(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let root_command = hyperion::simulation::command::get_root_command_entity(); diff --git a/crates/hyperion-respawn/src/lib.rs b/crates/hyperion-respawn/src/lib.rs index b3c55dbf..c8bbaa7f 100644 --- a/crates/hyperion-respawn/src/lib.rs +++ b/crates/hyperion-respawn/src/lib.rs @@ -1,7 +1,7 @@ use hyperion::{ flecs_ecs::{ self, - core::{EntityViewGet, World, WorldGet}, + core::{id, EntityViewGet, World, WorldGet}, macros::Component, prelude::Module, }, @@ -65,7 +65,7 @@ impl Module for RespawnModule { health.heal(20.); *pose = Pose::Standing; - client.modified::(); // this is so observers detect the change + client.modified(id::()); // this is so observers detect the change let pkt_health = play::HealthUpdateS2c { health: health.abs(), diff --git a/crates/hyperion/src/egress/mod.rs b/crates/hyperion/src/egress/mod.rs index 0179f981..7839f03e 100644 --- a/crates/hyperion/src/egress/mod.rs +++ b/crates/hyperion/src/egress/mod.rs @@ -46,8 +46,8 @@ impl Module for EgressModule { let pipeline = world .entity() - .add::() - .depends_on::(); + .add(id::()) + .depends_on(id::()); world.import::(); world.import::(); @@ -60,7 +60,7 @@ impl Module for EgressModule { &Compose($), &mut Blocks($), ) - .kind::() + .kind(id::()) .each_iter(move |it: TableIter<'_, false>, _, (compose, mc)| { let span = info_span!("broadcast_chunk_deltas"); let _enter = span.enter(); @@ -101,7 +101,7 @@ impl Module for EgressModule { &mut Compose($), &mut EgressComm($), ) - .kind_id(pipeline) + .kind(pipeline) .each(move |(compose, egress)| { let span = info_span!("egress"); let _enter = span.enter(); @@ -166,7 +166,7 @@ impl Module for EgressModule { world, &mut Compose($), ) - .kind_id(pipeline) + .kind(pipeline) .each(move |compose| { let span = info_span!("clear_bump"); let _enter = span.enter(); diff --git a/crates/hyperion/src/egress/player_join/mod.rs b/crates/hyperion/src/egress/player_join/mod.rs index 6251dc4e..410c9587 100644 --- a/crates/hyperion/src/egress/player_join/mod.rs +++ b/crates/hyperion/src/egress/player_join/mod.rs @@ -244,7 +244,7 @@ pub fn player_join_world( .iter_stage(world) .each_iter(|it, idx, (uuid, _, position, yaw, pitch, _, flags)| { let mut result = || { - let query_entity = it.entity(idx); + let query_entity = it.entity(idx).expect("idx must be in bounds"); if entity.id() == query_entity.id() { return anyhow::Ok(()); @@ -545,7 +545,7 @@ impl Module for PlayerJoinModule { &Config($), &RayonWorldStages($), ) - .kind::() + .kind(id::()) .each_iter( move |it, _, (comms, compose, crafting_registry, config, stages)| { let span = tracing::info_span!("joins"); diff --git a/crates/hyperion/src/egress/stats.rs b/crates/hyperion/src/egress/stats.rs index bb307b91..56c3b8d8 100644 --- a/crates/hyperion/src/egress/stats.rs +++ b/crates/hyperion/src/egress/stats.rs @@ -18,7 +18,7 @@ impl Module for StatsModule { // let system_id = GLOBAL_STATS; system!("global_update", world, &mut Compose($)) - .kind::() // ? OnUpdate + .kind(id::()) // ? OnUpdate .each_iter(move |_, _, compose| { let global = compose.global_mut(); @@ -41,7 +41,7 @@ impl Module for StatsModule { world, &mut Blocks($), ) - .kind::() + .kind(id::()) .each_iter(|_iter, _, blocks| { let span = info_span!("load_pending"); let _enter = span.enter(); diff --git a/crates/hyperion/src/egress/sync_chunks.rs b/crates/hyperion/src/egress/sync_chunks.rs index b046ac68..c8ad44b4 100644 --- a/crates/hyperion/src/egress/sync_chunks.rs +++ b/crates/hyperion/src/egress/sync_chunks.rs @@ -44,7 +44,7 @@ impl Module for SyncChunksModule { &mut ChunkSendQueue, ) .with_enum(PacketState::Play) - .kind::() + .kind(id::()) .each_iter( move |it, _, (compose, last_sent, pose, &stream_id, chunk_changes)| { let system = it.system(); @@ -159,8 +159,7 @@ impl Module for SyncChunksModule { system!("send_full_loaded_chunks", world, &Blocks($), &Compose($), &ConnectionId, &mut ChunkSendQueue) .with_enum(PacketState::Play) - .kind::() - + .kind(id::()) .each_iter( move |it, _, (chunks, compose, &stream_id, queue)| { const MAX_CHUNKS_PER_TICK: usize = 16; diff --git a/crates/hyperion/src/egress/sync_entity_state.rs b/crates/hyperion/src/egress/sync_entity_state.rs index 312e66de..c11ebd77 100644 --- a/crates/hyperion/src/egress/sync_entity_state.rs +++ b/crates/hyperion/src/egress/sync_entity_state.rs @@ -31,8 +31,8 @@ pub struct EntityStateSyncModule; fn track_previous(world: &World) { let post_store = world .entity_named("post_store") - .add::() - .depends_on::(); + .add(id::()) + .depends_on(id::()); // we include names so that if we call this multiple times, we don't get multiple observers/systems let component_name = std::any::type_name::(); @@ -46,14 +46,14 @@ fn track_previous(world: &World) { world .observer_named::(&observer_name) - .without::<(Prev, T)>() // we have not set Prev yet + .without((id::(), id::())) // we have not set Prev yet .each_entity(|entity, value| { entity.set_pair::(*value); }); world .system_named::<(&mut (Prev, T), &T)>(system_name.as_str()) - .kind_id(post_store) + .kind(post_store) .each(|(prev, value)| { *prev = *value; }); @@ -70,7 +70,7 @@ impl Module for EntityStateSyncModule { )>("entity_xp_sync") .term_at(0u32) .singleton() - .kind::() + .kind(id::()) .each_iter(|table, idx, (compose, net, prev_xp, current)| { const { assert!(size_of::() == size_of::()); @@ -87,8 +87,8 @@ impl Module for EntityStateSyncModule { total_xp: VarInt::default(), }; - let entity = table.entity(idx); - entity.modified::(); + let entity = table.entity(idx).expect("idx must be in bounds"); + entity.modified(id::()); compose.unicast(&packet, *net, system).unwrap(); } @@ -97,10 +97,10 @@ impl Module for EntityStateSyncModule { }); system!("entity_metadata_sync", world, &Compose($), &mut MetadataChanges) - .kind::() + .kind(id::()) .each_iter(move |it, row, (compose, metadata_changes)| { let system = it.system(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let entity_id = VarInt(entity.minecraft_id()); let metadata = get_and_clear_metadata(metadata_changes); @@ -110,7 +110,7 @@ impl Module for EntityStateSyncModule { entity_id, tracked_values: RawBytes(&view), }; - if entity.has::() { + if entity.has(id::()) { entity.get::<&Position>(|position| { compose .broadcast_local(&pkt, position.to_chunk(), system) @@ -132,12 +132,12 @@ impl Module for EntityStateSyncModule { ?&ConnectionId, &mut ActiveAnimation, ) - .kind::() + .kind(id::()) .each_iter( move |it, row, (position, compose, connection_id, animation)| { let io = connection_id.copied(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let system = it.system(); let entity_id = VarInt(entity.minecraft_id()); @@ -173,7 +173,7 @@ impl Module for EntityStateSyncModule { &mut MovementTracking, &Flight, ) - .kind::() + .kind(id::()) .each_iter( |it, row, @@ -192,7 +192,7 @@ impl Module for EntityStateSyncModule { )| { let world = it.system().world(); let system = it.system(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let entity_id = VarInt(entity.minecraft_id()); if let Some(pending_teleport) = pending_teleport { @@ -363,7 +363,7 @@ impl Module for EntityStateSyncModule { &Owner, ?&ConnectionId ) - .kind::() + .kind(id::()) .with_enum_wildcard::() .each_iter(|it, row, (position, velocity, owner, connection_id)| { if let Some(_connection_id) = connection_id { @@ -372,7 +372,7 @@ impl Module for EntityStateSyncModule { let system = it.system(); let world = system.world(); - let arrow_entity = it.entity(row); + let arrow_entity = it.entity(row).expect("row must be in bounds"); if velocity.0 != Vec3::ZERO { let center = **position; diff --git a/crates/hyperion/src/ingress/mod.rs b/crates/hyperion/src/ingress/mod.rs index 7f2f15ae..da5fb6d3 100644 --- a/crates/hyperion/src/ingress/mod.rs +++ b/crates/hyperion/src/ingress/mod.rs @@ -128,7 +128,7 @@ fn process_login( info!("Starting login: {username} {uuid_s}"); let skins = comms.skins_tx.clone(); - let id = entity.id(); + let entity_id = entity.id(); if profile_id.is_some() { tasks.spawn(async move { @@ -144,10 +144,10 @@ fn process_login( } }; - skins.send((id, skin)).unwrap(); + skins.send((entity_id, skin)).unwrap(); }); } else { - skins.send((id, PlayerSkin::EMPTY)).unwrap(); + skins.send((entity_id, PlayerSkin::EMPTY)).unwrap(); } let pkt = login::LoginSuccessS2c { @@ -162,19 +162,19 @@ fn process_login( *login_state = PacketState::Play; - ign_map.insert(username.clone(), entity.id(), world); + ign_map.insert(username.clone(), entity_id, world); world.get::<&MetadataPrefabs>(|prefabs| { entity - .is_a_id(prefabs.player_base) + .is_a(prefabs.player_base) .set(Name::from(username)) - .add::() + .add(id::()) .set(ImmuneStatus::default()) .set(Uuid::from(uuid)) - .add::() + .add(id::()) .set_pair::(Xp::default()) - .add::() - .add::() + .add(id::()) + .add(id::()) .set(ChunkPosition::null()) }); @@ -275,7 +275,7 @@ impl Module for IngressModule { world, &Shutdown($), ) - .kind::() + .kind(id::()) .each_iter(|it, _, shutdown| { let world = it.world(); if shutdown.value.load(std::sync::atomic::Ordering::Relaxed) { @@ -289,7 +289,7 @@ impl Module for IngressModule { world, &mut IgnMap($), ) - .kind::() + .kind(id::()) .each_iter(|_, _, ign_map| { let span = info_span!("update_ign_map"); let _enter = span.enter(); @@ -303,7 +303,7 @@ impl Module for IngressModule { &ReceiveState($), ) .immediate(true) - .kind::() + .kind(id::()) .term_at(0) .each_iter(move |it, _, (lookup, receive)| { tracing_tracy::client::Client::running() @@ -327,7 +327,7 @@ impl Module for IngressModule { .set(PacketState::Handshake) .set(ActiveAnimation::NONE) .set(PacketDecoder::default()) - .add::(); + .add(id::()); lookup.insert(connect, view.id()); } @@ -350,7 +350,7 @@ impl Module for IngressModule { .term_at(0u32) .singleton() // StreamLookup .immediate(true) - .kind::() + .kind(id::()) .each(move |(receive, connection_id, decoder)| { // 134µs with par_iter // 150-208µs with regular drain @@ -378,10 +378,10 @@ impl Module for IngressModule { &ConnectionId, &PendingRemove, ) - .kind::() + .kind(id::()) .each_iter(move |it, row, (uuid, compose, io, pending_remove)| { let system = it.system(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let uuids = &[uuid.0]; let entity_ids = [VarInt(entity.minecraft_id())]; @@ -416,8 +416,8 @@ impl Module for IngressModule { world .system_named::<()>("remove_player") - .kind::() - .with::<&PendingRemove>() + .kind(id::()) + .with(id::<&PendingRemove>()) .tracing_each_entity(info_span!("remove_player"), |entity, ()| { entity.destruct(); }); @@ -447,7 +447,7 @@ impl Module for IngressModule { &hyperion_crafting::CraftingRegistry($), &IgnMap($), ) - .kind::() + .kind(id::()) .each_iter( move |it, row, @@ -476,7 +476,7 @@ impl Module for IngressModule { )| { let system = it.system(); let world = it.world(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let bump = compose.bump.get(&world); diff --git a/crates/hyperion/src/lib.rs b/crates/hyperion/src/lib.rs index ba856c32..b1349a3a 100644 --- a/crates/hyperion/src/lib.rs +++ b/crates/hyperion/src/lib.rs @@ -273,7 +273,7 @@ impl HyperionCore { world.component::(); system!("run_tasks", world, &mut Tasks($)) - .with::() + .with(id::()) .each_iter(|it, _, tasks| { let world = it.world(); let span = info_span!("run_tasks"); @@ -381,16 +381,16 @@ impl HyperionCore { // add yaw and pitch world .observer::() - .with::() - .without::() + .with(id::()) + .without(id::()) .each_entity(|entity, ()| { entity.set(Yaw::default()); }); world .observer::() - .with::() - .without::() + .with(id::()) + .without(id::()) .each_entity(|entity, ()| { entity.set(Pitch::default()); }); diff --git a/crates/hyperion/src/simulation/command.rs b/crates/hyperion/src/simulation/command.rs index 0f09661e..5e756107 100644 --- a/crates/hyperion/src/simulation/command.rs +++ b/crates/hyperion/src/simulation/command.rs @@ -163,7 +163,7 @@ mod tests { }, has_permission: |_: _, _: _| true, }) - .child_of_id(root); + .child_of(root); let packet = get_command_packet(&world, root.id(), None); @@ -191,7 +191,7 @@ mod tests { }, has_permission: |_: _, _: _| true, }) - .child_of_id(root); + .child_of(root); let _child = world .entity() @@ -201,7 +201,7 @@ mod tests { }, has_permission: |_: _, _: _| true, }) - .child_of_id(parent); + .child_of(parent); let packet = get_command_packet(&world, root.id(), None); @@ -234,7 +234,7 @@ mod tests { }, has_permission: |_: _, _: _| true, }) - .child_of_id(parent); + .child_of(parent); parent = child; } diff --git a/crates/hyperion/src/simulation/handlers.rs b/crates/hyperion/src/simulation/handlers.rs index 87e95742..eebb14d7 100644 --- a/crates/hyperion/src/simulation/handlers.rs +++ b/crates/hyperion/src/simulation/handlers.rs @@ -5,7 +5,7 @@ #![allow(clippy::trivially_copy_pass_by_ref)] use anyhow::bail; -use flecs_ecs::core::{Entity, EntityView, EntityViewGet, World}; +use flecs_ecs::core::{Entity, EntityView, EntityViewGet, World, id}; use geometry::aabb::Aabb; use glam::{DVec3, IVec3, Vec3}; use hyperion_utils::{EntityExt, LifetimeHandle, RuntimeLifetime}; @@ -594,7 +594,7 @@ pub fn confirm_teleportation( } **query.position = pending_teleport.destination; - entity.remove::(); + entity.remove(id::()); } }); diff --git a/crates/hyperion/src/simulation/inventory.rs b/crates/hyperion/src/simulation/inventory.rs index 7377cc53..bfee416e 100644 --- a/crates/hyperion/src/simulation/inventory.rs +++ b/crates/hyperion/src/simulation/inventory.rs @@ -1,7 +1,9 @@ use std::borrow::Cow; use flecs_ecs::{ - core::{EntityView, EntityViewGet, QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, flecs}, + core::{ + EntityView, EntityViewGet, QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, flecs, id, + }, macros::{Component, observer, system}, prelude::Module, }; @@ -51,7 +53,7 @@ impl Module for InventoryModule { |it, row, (open_inventory, compose, inv_state, cursor_item, io)| { let system = it.system(); let world = it.world(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let _entity_id = VarInt(entity.minecraft_id()); let stream_id = *io; @@ -99,7 +101,7 @@ impl Module for InventoryModule { .each_iter(|it, row, (_open_inventory, compose, inv_state, io)| { let system = it.system(); let _world = it.world(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let _entity_id = VarInt(entity.minecraft_id()); let stream_id = *io; @@ -123,8 +125,7 @@ impl Module for InventoryModule { ?&OpenInventory, &ConnectionId, ) - - .kind::() + .kind(id::()) .each_iter( | it, @@ -133,7 +134,7 @@ impl Module for InventoryModule { | { let system = it.system(); let world = it.world(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let entity_id = VarInt(entity.minecraft_id()); let stream_id = *io; @@ -1172,7 +1173,10 @@ pub fn close_handled_screen( // try to remove OpenInventory from the player if pkt.window_id isnt 0 if pkt.window_id != 0 { - query.id.entity_view(query.world).remove::(); + query + .id + .entity_view(query.world) + .remove(id::()); } Ok(()) diff --git a/crates/hyperion/src/simulation/metadata/mod.rs b/crates/hyperion/src/simulation/metadata/mod.rs index b739c30a..314a755c 100644 --- a/crates/hyperion/src/simulation/metadata/mod.rs +++ b/crates/hyperion/src/simulation/metadata/mod.rs @@ -2,7 +2,9 @@ use std::fmt::Debug; use flecs_ecs::{ addons::Meta, - core::{ComponentId, Entity, EntityView, IdOperations, SystemAPI, World, WorldProvider, flecs}, + core::{ + ComponentId, Entity, EntityView, IdOperations, SystemAPI, World, WorldProvider, flecs, id, + }, macros::Component, }; use valence_protocol::{Encode, VarInt}; @@ -45,7 +47,7 @@ where &mut T, // (1) &mut MetadataChanges, // (2) )>(system_name) - .kind::() + .kind(id::()) .each(|(prev, current, metadata_changes)| { if prev != current { metadata_changes.encode(*current); @@ -97,7 +99,7 @@ pub fn register_prefabs(world: &World) -> MetadataPrefabs { world.component::(); let entity_base = entity::register_prefab(world, None) - .add::() + .add(id::()) .component_and_track::() .component_and_track::() .id(); @@ -107,7 +109,7 @@ pub fn register_prefabs(world: &World) -> MetadataPrefabs { let living_entity_base = living_entity::register_prefab(world, Some(entity_base)).id(); let player_base = player::register_prefab(world, Some(living_entity_base)) - // .add::() + // .add(id::()) .add_enum(EntityKind::Player) .id(); @@ -219,7 +221,7 @@ macro_rules! define_and_register_components { let mut entity = world.prefab(); if let Some(entity_base) = entity_base { - entity = entity.is_a_id(entity_base); + entity = entity.is_a(entity_base); } $crate::register_component_ids!( diff --git a/crates/hyperion/src/simulation/mod.rs b/crates/hyperion/src/simulation/mod.rs index 9eed6fa8..47dc0366 100644 --- a/crates/hyperion/src/simulation/mod.rs +++ b/crates/hyperion/src/simulation/mod.rs @@ -633,7 +633,7 @@ pub struct SimModule; impl Module for SimModule { fn module(world: &World) { - component!(world, VarInt).member::("x"); + component!(world, VarInt).member(id::(), "x"); component!(world, EntitySize).opaque_func(meta_ser_stringify_type_display::); @@ -649,12 +649,12 @@ impl Module for SimModule { }); component!(world, Quat) - .member::("x") - .member::("y") - .member::("z") - .member::("w"); + .member(id::(), "x") + .member(id::(), "y") + .member(id::(), "z") + .member(id::(), "w"); - component!(world, BlockState).member::("id"); + component!(world, BlockState).member(id::(), "id"); world.component::().meta(); world.component::(); @@ -720,12 +720,12 @@ impl Module for SimModule { [filter] & Yaw, [filter] & Velocity, ) - .with::() + .with(id::()) .with_enum_wildcard::() .each_iter(|it, row, (compose, uuid, position, pitch, yaw, velocity)| { let system = it.system(); - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let minecraft_id = entity.minecraft_id(); let mut bundle = DataBundle::new(compose, system); @@ -774,7 +774,7 @@ impl Module for SimModule { world .observer::() .with_enum_wildcard::() - .without::() + .without(id::()) .each_entity(|entity, ()| { debug!("adding uuid to entity"); let uuid = uuid::Uuid::new_v4(); @@ -787,10 +787,10 @@ impl Module for SimModule { .each_entity(move |entity, ()| { entity.get::<&EntityKind>(|kind| match kind { EntityKind::BlockDisplay => { - entity.is_a_id(prefabs.block_display_base); + entity.is_a(prefabs.block_display_base); } EntityKind::Player => { - entity.is_a_id(prefabs.player_base); + entity.is_a(prefabs.player_base); } _ => {} }); diff --git a/crates/hyperion/src/spatial/mod.rs b/crates/hyperion/src/spatial/mod.rs index a7b25922..0fd0d396 100644 --- a/crates/hyperion/src/spatial/mod.rs +++ b/crates/hyperion/src/spatial/mod.rs @@ -1,7 +1,7 @@ use flecs_ecs::{ core::{ Builder, Entity, EntityView, EntityViewGet, IdOperations, QueryAPI, QueryBuilderImpl, - SystemAPI, TermBuilderImpl, World, WorldGet, flecs, + SystemAPI, TermBuilderImpl, World, WorldGet, flecs, id, }, macros::{Component, system}, prelude::Module, @@ -126,9 +126,9 @@ fn all_indexed_entities(world: &World) -> Vec { // todo(perf): can we cache this? let query = world .query::<()>() - .with::() - .with::() - .with::() + .with(id::()) + .with(id::()) + .with(id::()) .build(); let count = query.count(); @@ -146,14 +146,14 @@ impl Module for SpatialModule { fn module(world: &World) { world.component::(); world.component::(); - world.add::(); + world.add(id::()); system!( "recalculate_spatial_index", world, &mut SpatialIndex($), ) - .with::() + .with(id::()) .each_iter(|it, _, index| { let world = it.world(); index.recalculate(&world); diff --git a/crates/hyperion/tests/collision.rs b/crates/hyperion/tests/collision.rs index a1bbd0d9..af2ef8f1 100644 --- a/crates/hyperion/tests/collision.rs +++ b/crates/hyperion/tests/collision.rs @@ -5,7 +5,7 @@ for the core libraries. These are tests, so it doesn't matter" )] -use flecs_ecs::core::{EntityView, EntityViewGet, QueryBuilderImpl, SystemAPI, World, flecs}; +use flecs_ecs::core::{EntityView, EntityViewGet, QueryBuilderImpl, SystemAPI, World, flecs, id}; use glam::Vec3; use hyperion::{ HyperionCore, @@ -37,7 +37,7 @@ fn test_get_first_collision() { .observer::() .with_enum_wildcard::() .each_entity(|entity, ()| { - entity.add::(); + entity.add(id::()); }); // Create a player entity diff --git a/crates/hyperion/tests/entity.rs b/crates/hyperion/tests/entity.rs index 7ddae799..7d18ff21 100644 --- a/crates/hyperion/tests/entity.rs +++ b/crates/hyperion/tests/entity.rs @@ -5,7 +5,7 @@ )] use flecs_ecs::{ - core::{EntityViewGet, World}, + core::{EntityViewGet, World, id}, macros::Component, prelude::Module, }; @@ -34,7 +34,7 @@ fn arrow() { let owner = world.entity(); assert!( - arrow.has::(), + arrow.has(id::()), "All entities should automatically be given a UUID." ); diff --git a/crates/hyperion/tests/spatial.rs b/crates/hyperion/tests/spatial.rs index e65ed951..0a01b188 100644 --- a/crates/hyperion/tests/spatial.rs +++ b/crates/hyperion/tests/spatial.rs @@ -8,7 +8,7 @@ use std::{assert_matches::assert_matches, collections::HashSet}; use approx::assert_relative_eq; -use flecs_ecs::core::{QueryBuilderImpl, SystemAPI, World, WorldGet, flecs}; +use flecs_ecs::core::{QueryBuilderImpl, SystemAPI, World, WorldGet, flecs, id}; use geometry::{aabb::Aabb, ray::Ray}; use glam::Vec3; use hyperion::{ @@ -29,7 +29,7 @@ fn spatial() { .observer::() .with_enum_wildcard::() .each_entity(|entity, ()| { - entity.add::(); + entity.add(id::()); }); let zombie = world diff --git a/crates/system-order/src/lib.rs b/crates/system-order/src/lib.rs index ed41766a..ddb07df7 100644 --- a/crates/system-order/src/lib.rs +++ b/crates/system-order/src/lib.rs @@ -4,7 +4,7 @@ use derive_more::Constructor; use flecs_ecs::{ core::{ Builder, ComponentOrPairId, Entity, EntityView, EntityViewGet, IdOperations, QueryAPI, - QueryBuilderImpl, SystemAPI, flecs, flecs::DependsOn, + QueryBuilderImpl, SystemAPI, flecs, flecs::DependsOn, id, }, macros::Component, prelude::{Module, World}, @@ -31,7 +31,7 @@ impl DepthCalculator { // todo: add stackoverflow check let mut entity_depth = 0; - view.each_target::(|depends_on| { + view.each_target(id::(), |depends_on| { let tentative_depth = self.calculate_depth(depends_on) + 1; entity_depth = entity_depth.max(tentative_depth); }); @@ -86,7 +86,7 @@ fn calculate(world: &World) { // get all depths for systems world .query::<()>() - .with::() + .with(id::()) .build() .each_entity(|entity, ()| { let depth = depth_calculator.calculate_depth(entity); @@ -100,7 +100,7 @@ fn calculate(world: &World) { // handle all observers world .query::<()>() - .with::() + .with(id::()) .build() .each_entity(|entity, ()| { let depth = depth_calculator.on_update_depth(world); @@ -135,12 +135,12 @@ impl Module for SystemOrderModule { world .observer::() - .with::() + .with(id::()) .run(|it| calculate(&it.world())); world .observer::() - .with::() + .with(id::()) .run(|it| calculate(&it.world())); } } diff --git a/events/tag/src/command/class.rs b/events/tag/src/command/class.rs index e0ce8100..e4e851e2 100644 --- a/events/tag/src/command/class.rs +++ b/events/tag/src/command/class.rs @@ -1,5 +1,5 @@ use clap::Parser; -use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldGet, WorldProvider}; +use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldGet, WorldProvider, id}; use hyperion::net::{Compose, ConnectionId, agnostic}; use hyperion_clap::{CommandPermission, MinecraftCommand}; use hyperion_rank_tree::{Class, Team}; @@ -30,12 +30,12 @@ impl MinecraftCommand for ClassCommand { if *team != team_param { *team = team_param; - caller.modified::(); + caller.modified(id::()); } if *class != class_param { *class = class_param; - caller.modified::(); + caller.modified(id::()); } let msg = format!("Setting rank to {class:?}"); diff --git a/events/tag/src/command/fly.rs b/events/tag/src/command/fly.rs index d5622f90..153c1258 100644 --- a/events/tag/src/command/fly.rs +++ b/events/tag/src/command/fly.rs @@ -1,5 +1,5 @@ use clap::Parser; -use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldGet, WorldProvider}; +use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldGet, WorldProvider, id}; use hyperion::{ net::{Compose, ConnectionId, DataBundle, agnostic}, simulation::Flight, @@ -20,7 +20,7 @@ impl MinecraftCommand for FlyCommand { .get::<(&mut Flight, &ConnectionId)>(|(flight, stream)| { flight.allow = !flight.allow; flight.is_flying = flight.allow && flight.is_flying; - caller.entity_view(world).modified::(); + caller.entity_view(world).modified(id::()); let allow_flight = flight.allow; diff --git a/events/tag/src/command/spawn.rs b/events/tag/src/command/spawn.rs index 2b04b893..224600bf 100644 --- a/events/tag/src/command/spawn.rs +++ b/events/tag/src/command/spawn.rs @@ -1,6 +1,6 @@ use clap::Parser; use flecs_ecs::{ - core::{Entity, WorldProvider}, + core::{Entity, WorldProvider, id}, prelude::EntityView, }; use hyperion::{ @@ -40,9 +40,9 @@ impl MinecraftCommand for SpawnCommand { .set(Pitch::new(0.0)) .set(Yaw::new(0.0)) .set(Velocity::new(0.0, 0.0, 0.0)) - .add::() + .add(id::()) .set(DisplayedBlockState::new(BlockState::DIRT)) - // .is_a_id(prefabs.block_display_base) + // .is_a(prefabs.block_display_base) .enqueue(Spawn); } } diff --git a/events/tag/src/command/xp.rs b/events/tag/src/command/xp.rs index c315375d..13e7ec9a 100644 --- a/events/tag/src/command/xp.rs +++ b/events/tag/src/command/xp.rs @@ -1,5 +1,5 @@ use clap::Parser; -use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldProvider}; +use flecs_ecs::core::{Entity, EntityView, EntityViewGet, WorldProvider, id}; use hyperion::simulation::Xp; use hyperion_clap::{CommandPermission, MinecraftCommand}; @@ -19,7 +19,7 @@ impl MinecraftCommand for XpCommand { caller.get::<&mut Xp>(|xp| { xp.amount = amount; - caller.modified::(); + caller.modified(id::()); }); } } diff --git a/events/tag/src/lib.rs b/events/tag/src/lib.rs index 35727d4f..e0a0ffbe 100644 --- a/events/tag/src/lib.rs +++ b/events/tag/src/lib.rs @@ -109,7 +109,7 @@ impl Module for TagModule { &SpatialIndex($), &mut Position, ) - .with::() + .with(id::()) .each_entity(|entity, (index, position)| { let world = entity.world(); diff --git a/events/tag/src/module/attack.rs b/events/tag/src/module/attack.rs index ddd262ee..a9046320 100644 --- a/events/tag/src/module/attack.rs +++ b/events/tag/src/module/attack.rs @@ -4,7 +4,7 @@ use compact_str::format_compact; use flecs_ecs::{ core::{ Builder, ComponentOrPairId, EntityView, EntityViewGet, QueryAPI, QueryBuilderImpl, - SystemAPI, TableIter, TermBuilderImpl, World, WorldGet, flecs, + SystemAPI, TableIter, TermBuilderImpl, World, WorldGet, flecs, id, }, macros::{Component, system}, prelude::Module, @@ -104,7 +104,7 @@ impl Module for AttackModule { &ConnectionId, ) .with_enum(PacketState::Play) - .kind::() + .kind(id::()) .each_iter(move |it, _, (compose, kill_count, stream)| { const MAX_KILLS: usize = 10; @@ -297,7 +297,7 @@ impl Module for AttackModule { }; *target_pose = Pose::Dying; - target.modified::(); + target.modified(id::()); compose.broadcast(&pkt, system).send().unwrap(); compose.broadcast(&particle_pkt, system).send().unwrap(); compose.broadcast(&particle_pkt2, system).send().unwrap(); diff --git a/events/tag/src/module/block.rs b/events/tag/src/module/block.rs index 28e2dbe2..f116e5d2 100644 --- a/events/tag/src/module/block.rs +++ b/events/tag/src/module/block.rs @@ -4,7 +4,9 @@ use std::{ }; use flecs_ecs::{ - core::{Entity, EntityViewGet, QueryBuilderImpl, SystemAPI, TableIter, TermBuilderImpl, World}, + core::{ + Entity, EntityViewGet, QueryBuilderImpl, SystemAPI, TableIter, TermBuilderImpl, World, id, + }, macros::{Component, system}, prelude::Module, }; @@ -72,8 +74,7 @@ impl Module for BlockModule { world.set(PendingDestruction::default()); system!("handle_pending_air", world, &mut PendingDestruction($), &mut Blocks($), &Compose($)) - .write::() - + .write(id::()) .each_iter( move |it: TableIter<'_, false>, _, diff --git a/events/tag/src/module/bow.rs b/events/tag/src/module/bow.rs index fe2b7834..83122065 100644 --- a/events/tag/src/module/bow.rs +++ b/events/tag/src/module/bow.rs @@ -85,7 +85,7 @@ impl Module for BowModule { &mut EventQueue, ) .singleton() - .kind::() + .kind(id::()) .each_iter(move |it, _, event_queue| { let _system = it.system(); let world = it.world(); @@ -111,7 +111,7 @@ impl Module for BowModule { world, &mut EventQueue($), ) - .kind::() + .kind(id::()) .each_iter(move |it, _, event_queue| { let _system = it.system(); let world = it.world(); @@ -203,7 +203,7 @@ impl Module for BowModule { &mut EventQueue, ) .singleton() - .kind::() + .kind(id::()) .each_iter(move |it, _, (compose, event_queue)| { let system = it.system(); let world = it.world(); @@ -261,7 +261,7 @@ impl Module for BowModule { world, &mut EventQueue, ) - .kind::() + .kind(id::()) .each_iter(move |it, _, event_queue| { let _system = it.system(); let world = it.world(); diff --git a/events/tag/src/module/spawn.rs b/events/tag/src/module/spawn.rs index 334fa036..a0535c3f 100644 --- a/events/tag/src/module/spawn.rs +++ b/events/tag/src/module/spawn.rs @@ -1,7 +1,7 @@ use std::{cell::RefCell, rc::Rc}; use flecs_ecs::{ - core::{QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, flecs}, + core::{QueryBuilderImpl, SystemAPI, TermBuilderImpl, World, flecs, id}, macros::{Component, observer}, prelude::Module, }; @@ -60,7 +60,7 @@ impl Module for SpawnModule { &mut Blocks($), &AsyncRuntime($) , ) - .without::() + .without(id::()) .each_entity({ let positions = Rc::clone(&positions); move |entity, (uuid, blocks, runtime)| { diff --git a/events/tag/src/module/vanish.rs b/events/tag/src/module/vanish.rs index bd18a614..d256c377 100644 --- a/events/tag/src/module/vanish.rs +++ b/events/tag/src/module/vanish.rs @@ -36,9 +36,9 @@ impl Module for VanishModule { &Vanished, &Uuid, ) - .kind::() + .kind(id::()) .each_iter(move |it, row, (compose, _connection_id, vanished, uuid)| { - let entity = it.entity(row); + let entity = it.entity(row).expect("row must be in bounds"); let system = it.system(); let world = it.world();