mirror of
https://github.com/mat-1/azalea.git
synced 2025-08-02 14:26:04 +00:00
ok what if i just have a bunch of queries and a single packet handler system
This commit is contained in:
parent
f02db24e8c
commit
45fd8a0e98
4 changed files with 769 additions and 819 deletions
File diff suppressed because it is too large
Load diff
|
@ -46,7 +46,7 @@ impl ClientboundAddEntityPacket {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Apply the default metadata for the given entity.
|
/// Apply the default metadata for the given entity.
|
||||||
pub fn apply_metadata(&self, entity: &mut bevy_ecs::world::EntityMut) {
|
pub fn apply_metadata(&self, entity: &mut bevy_ecs::system::EntityCommands) {
|
||||||
apply_default_metadata(entity, self.entity_type);
|
apply_default_metadata(entity, self.entity_type);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
File diff suppressed because it is too large
Load diff
|
@ -183,7 +183,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
|
|
||||||
# impl Allay {
|
# impl Allay {
|
||||||
# pub fn apply_metadata(
|
# pub fn apply_metadata(
|
||||||
# entity: &mut bevy_ecs::world::EntityMut,
|
# entity: &mut bevy_ecs::system::EntityCommands,
|
||||||
# d: EntityDataItem,
|
# d: EntityDataItem,
|
||||||
# ) -> Result<(), UpdateMetadataError> {
|
# ) -> Result<(), UpdateMetadataError> {
|
||||||
# match d.index {
|
# match d.index {
|
||||||
|
@ -196,7 +196,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
# }
|
# }
|
||||||
code.append(f'impl {struct_name} {{')
|
code.append(f'impl {struct_name} {{')
|
||||||
code.append(
|
code.append(
|
||||||
f' pub fn apply_metadata(entity: &mut bevy_ecs::world::EntityMut, d: EntityDataItem) -> Result<(), UpdateMetadataError> {{')
|
f' pub fn apply_metadata(entity: &mut bevy_ecs::system::EntityCommands, d: EntityDataItem) -> Result<(), UpdateMetadataError> {{')
|
||||||
code.append(f' match d.index {{')
|
code.append(f' match d.index {{')
|
||||||
|
|
||||||
parent_last_index = -1
|
parent_last_index = -1
|
||||||
|
@ -400,7 +400,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
|
|
||||||
# and now make the main apply_metadata
|
# and now make the main apply_metadata
|
||||||
# pub fn apply_metadata(
|
# pub fn apply_metadata(
|
||||||
# entity: &mut bevy_ecs::world::EntityMut,
|
# entity: &mut bevy_ecs::system::EntityCommands,
|
||||||
# items: Vec<EntityDataItem>,
|
# items: Vec<EntityDataItem>,
|
||||||
# ) -> Result<(), UpdateMetadataError> {
|
# ) -> Result<(), UpdateMetadataError> {
|
||||||
# if entity.contains::<Allay>() {
|
# if entity.contains::<Allay>() {
|
||||||
|
@ -413,10 +413,12 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
# Ok(())
|
# Ok(())
|
||||||
# }
|
# }
|
||||||
code.append(
|
code.append(
|
||||||
f'pub fn apply_metadata(entity: &mut bevy_ecs::world::EntityMut, items: Vec<EntityDataItem>) -> Result<(), UpdateMetadataError> {{')
|
f'''pub fn apply_metadata(
|
||||||
code.append(
|
entity: &mut bevy_ecs::system::EntityCommands,
|
||||||
' let entity_kind = entity.get::<super::EntityKind>().unwrap();')
|
entity_kind: azalea_registry::EntityKind,
|
||||||
code.append(' match **entity_kind {')
|
items: Vec<EntityDataItem>,
|
||||||
|
) -> Result<(), UpdateMetadataError> {{
|
||||||
|
match entity_kind {{''')
|
||||||
for entity_id in burger_entity_data:
|
for entity_id in burger_entity_data:
|
||||||
if entity_id.startswith('~'):
|
if entity_id.startswith('~'):
|
||||||
# not actually an entity
|
# not actually an entity
|
||||||
|
@ -434,7 +436,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
code.append('}')
|
code.append('}')
|
||||||
code.append('')
|
code.append('')
|
||||||
|
|
||||||
# pub fn apply_default_metadata(entity: &mut bevy_ecs::world::EntityMut, kind: azalea_registry::EntityKind) {
|
# pub fn apply_default_metadata(entity: &mut bevy_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) {
|
||||||
# match kind {
|
# match kind {
|
||||||
# azalea_registry::EntityKind::AreaEffectCloud => {
|
# azalea_registry::EntityKind::AreaEffectCloud => {
|
||||||
# entity.insert(AreaEffectCloudMetadataBundle::default());
|
# entity.insert(AreaEffectCloudMetadataBundle::default());
|
||||||
|
@ -442,7 +444,7 @@ impl From<EntityDataValue> for UpdateMetadataError {
|
||||||
# }
|
# }
|
||||||
# }
|
# }
|
||||||
code.append(
|
code.append(
|
||||||
'pub fn apply_default_metadata(entity: &mut bevy_ecs::world::EntityMut, kind: azalea_registry::EntityKind) {')
|
'pub fn apply_default_metadata(entity: &mut bevy_ecs::system::EntityCommands, kind: azalea_registry::EntityKind) {')
|
||||||
code.append(' match kind {')
|
code.append(' match kind {')
|
||||||
for entity_id in burger_entity_data:
|
for entity_id in burger_entity_data:
|
||||||
if entity_id.startswith('~'):
|
if entity_id.startswith('~'):
|
||||||
|
|
Loading…
Add table
Reference in a new issue