Skip to content

Commit

Permalink
Rename ArchetypeEntity::entity into ArchetypeEntity::id (#11118)
Browse files Browse the repository at this point in the history
# Objective

Fixes #11050

Rename ArchetypeEntity::entity to ArchetypeEntity::id to be consistent
with `EntityWorldMut`, `EntityMut` and `EntityRef`.

## Migration Guide

The method `ArchetypeEntity::entity` has been renamed to
`ArchetypeEntity::id`
  • Loading branch information
capt-glorypants authored Jan 1, 2024
1 parent bf0be9c commit ffded5b
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_ecs/src/archetype.rs
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ pub struct ArchetypeEntity {
impl ArchetypeEntity {
/// The ID of the entity.
#[inline]
pub const fn entity(&self) -> Entity {
pub const fn id(&self) -> Entity {
self.entity
}

Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_ecs/src/query/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIter<'w, 's, D, F> {
// Caller assures `index` in range of the current archetype.
if !F::filter_fetch(
&mut self.cursor.filter,
archetype_entity.entity(),
archetype_entity.id(),
archetype_entity.table_row(),
) {
continue;
Expand All @@ -188,7 +188,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIter<'w, 's, D, F> {
// Caller assures `index` in range of the current archetype.
let item = D::fetch(
&mut self.cursor.fetch,
archetype_entity.entity(),
archetype_entity.id(),
archetype_entity.table_row(),
);

Expand Down Expand Up @@ -719,7 +719,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIterationCursor<'w, 's, D, F> {
let archetype_entity = self.archetype_entities.get_unchecked(index);
Some(D::fetch(
&mut self.fetch,
archetype_entity.entity(),
archetype_entity.id(),
archetype_entity.table_row(),
))
}
Expand Down Expand Up @@ -817,7 +817,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIterationCursor<'w, 's, D, F> {
let archetype_entity = self.archetype_entities.get_unchecked(self.current_row);
if !F::filter_fetch(
&mut self.filter,
archetype_entity.entity(),
archetype_entity.id(),
archetype_entity.table_row(),
) {
self.current_row += 1;
Expand All @@ -831,7 +831,7 @@ impl<'w, 's, D: QueryData, F: QueryFilter> QueryIterationCursor<'w, 's, D, F> {
// - fetch is only called once for each `archetype_entity`.
let item = D::fetch(
&mut self.fetch,
archetype_entity.entity(),
archetype_entity.id(),
archetype_entity.table_row(),
);
self.current_row += 1;
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_ecs/src/world/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ impl World {
.iter()
.enumerate()
.map(|(archetype_row, archetype_entity)| {
let entity = archetype_entity.entity();
let entity = archetype_entity.id();
let location = EntityLocation {
archetype_id: archetype.id(),
archetype_row: ArchetypeRow::new(archetype_row),
Expand Down Expand Up @@ -536,7 +536,7 @@ impl World {
.iter()
.enumerate()
.map(move |(archetype_row, archetype_entity)| {
let entity = archetype_entity.entity();
let entity = archetype_entity.id();
let location = EntityLocation {
archetype_id: archetype.id(),
archetype_row: ArchetypeRow::new(archetype_row),
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_scene/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ impl Scene {
for scene_entity in archetype.entities() {
let entity = *instance_info
.entity_map
.entry(scene_entity.entity())
.entry(scene_entity.id())
.or_insert_with(|| world.spawn_empty().id());
for component_id in archetype.components() {
let component_info = self
Expand All @@ -117,7 +117,7 @@ impl Scene {
}
})
})?;
reflect_component.copy(&self.world, world, scene_entity.entity(), entity);
reflect_component.copy(&self.world, world, scene_entity.id(), entity);
}
}
}
Expand Down

0 comments on commit ffded5b

Please sign in to comment.