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

update block shapes

This commit is contained in:
mat 2023-09-29 16:34:23 -05:00
parent 0bf8291388
commit fd63adcb41
4 changed files with 5115 additions and 5086 deletions

View file

@ -3080,46 +3080,60 @@ make_block_states! {
powered: false,
},
skeleton_skull => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: SkeletonSkullRotation::_0,
},
skeleton_wall_skull => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
wither_skeleton_skull => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: WitherSkeletonSkullRotation::_0,
},
wither_skeleton_wall_skull => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
zombie_head => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: ZombieHeadRotation::_0,
},
zombie_wall_head => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
player_head => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: PlayerHeadRotation::_0,
},
player_wall_head => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
creeper_head => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: CreeperHeadRotation::_0,
},
creeper_wall_head => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
dragon_head => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: DragonHeadRotation::_0,
},
dragon_wall_head => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
piglin_head => BlockBehavior::new().strength(1.0, 1.0), {
powered: false,
rotation: PiglinHeadRotation::_0,
},
piglin_wall_head => BlockBehavior::new().strength(1.0, 1.0), {
facing: FacingCardinal::North,
powered: false,
},
anvil => BlockBehavior::new().requires_correct_tool_for_drops().strength(5.0, 1200.0), {
facing: FacingCardinal::North,
@ -3341,7 +3355,9 @@ make_block_states! {
waterlogged: false,
},
slime_block => BlockBehavior::new().friction(0.8), {},
barrier => BlockBehavior::new().strength(-1.0, 3600000.8), {},
barrier => BlockBehavior::new().strength(-1.0, 3600000.8), {
waterlogged: false,
},
light => BlockBehavior::new().strength(-1.0, 3600000.8), {
level: LightLevel::_15,
waterlogged: false,

View file

@ -690,6 +690,8 @@ pub fn process_packet_events(ecs: &mut World) {
// per-client id index
entity_id_index.insert(entity_id, ecs_entity);
debug!("added to LoadedBy of entity {ecs_entity:?} with id {entity_id:?}");
continue;
};
@ -698,7 +700,8 @@ pub fn process_packet_events(ecs: &mut World) {
let bundle = p.as_entity_bundle((**instance_name).clone());
let mut spawned =
commands.spawn((entity_id, LoadedBy(HashSet::from([player_entity])), bundle));
let ecs_entity = spawned.id();
let ecs_entity: Entity = spawned.id();
debug!("spawned entity {ecs_entity:?} with id {entity_id:?}");
azalea_entity::indexing::add_entity_to_indexes(
entity_id,
@ -946,8 +949,13 @@ pub fn process_packet_events(ecs: &mut World) {
);
continue;
};
// the [`remove_despawned_entities_from_indexes`] system will despawn the entity
// if it's not loaded by anything anymore
// also we can't just ecs.despawn because if we're in a swarm then the entity
// might still be loaded by another client
loaded_by.remove(&player_entity);
}
}

File diff suppressed because it is too large Load diff

View file

@ -58,7 +58,7 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
// let entity_collisions = world.get_entity_collisions(self,
// entity_bounding_box.expand_towards(movement));
let entity_collisions = Vec::new();
let collided_movement = if movement.length_sqr() == 0.0 {
let collided_delta = if movement.length_sqr() == 0.0 {
*movement
} else {
collide_bounding_box(
@ -69,15 +69,15 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
)
};
let x_collision = movement.x != collided_movement.x;
let y_collision = movement.y != collided_movement.y;
let z_collision = movement.z != collided_movement.z;
let x_collision = movement.x != collided_delta.x;
let y_collision = movement.y != collided_delta.y;
let z_collision = movement.z != collided_delta.z;
let on_ground = physics.on_ground || y_collision && movement.y < 0.;
let max_up_step = 0.6;
if on_ground && (x_collision || z_collision) {
let mut hypothetical_new_position = collide_bounding_box(
if max_up_step > 0. && on_ground && (x_collision || z_collision) {
let mut step_to_delta = collide_bounding_box(
&Vec3 {
x: movement.x,
y: max_up_step,
@ -87,7 +87,7 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
world,
entity_collisions.clone(),
);
let step_up_position = collide_bounding_box(
let directly_up_delta = collide_bounding_box(
&Vec3 {
x: 0.,
y: max_up_step,
@ -97,41 +97,38 @@ fn collide(movement: &Vec3, world: &Instance, physics: &azalea_entity::Physics)
world,
entity_collisions.clone(),
);
if step_up_position.y < max_up_step {
let var11 = collide_bounding_box(
if directly_up_delta.y < max_up_step {
let target_movement = collide_bounding_box(
&Vec3 {
x: movement.x,
y: 0.,
z: movement.z,
},
&entity_bounding_box.move_relative(&step_up_position),
&entity_bounding_box.move_relative(&directly_up_delta),
world,
entity_collisions.clone(),
)
.add(step_up_position);
if var11.horizontal_distance_sqr() > hypothetical_new_position.horizontal_distance_sqr()
{
hypothetical_new_position = var11;
.add(directly_up_delta);
if target_movement.horizontal_distance_sqr() > step_to_delta.horizontal_distance_sqr() {
step_to_delta = target_movement;
}
}
if hypothetical_new_position.horizontal_distance_sqr()
> collided_movement.horizontal_distance_sqr()
{
return hypothetical_new_position.add(collide_bounding_box(
if step_to_delta.horizontal_distance_sqr() > collided_delta.horizontal_distance_sqr() {
return step_to_delta.add(collide_bounding_box(
&Vec3 {
x: 0.,
y: -hypothetical_new_position.y + movement.y,
y: -step_to_delta.y + movement.y,
z: 0.,
},
&entity_bounding_box.move_relative(&hypothetical_new_position),
&entity_bounding_box.move_relative(&step_to_delta),
world,
entity_collisions.clone(),
));
}
}
collided_movement
collided_delta
}
/// Move an entity by a given delta, checking for collisions.