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 changes: 1 addition & 1 deletion assets/entities.json

Large diffs are not rendered by default.

34 changes: 33 additions & 1 deletion pumpkin-data/src/generated/entity_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5504,7 +5504,39 @@ impl EntityType {
};
pub const PLAYER: EntityType = EntityType {
id: 155,
attributes: &[],
attributes: &[
(Attributes::ARMOR, 0f64),
(Attributes::ARMOR_TOUGHNESS, 0f64),
(Attributes::ATTACK_DAMAGE, 1f64),
(Attributes::ATTACK_KNOCKBACK, 0f64),
(Attributes::ATTACK_SPEED, 4f64),
(Attributes::BLOCK_BREAK_SPEED, 1f64),
(Attributes::BLOCK_INTERACTION_RANGE, 4.5f64),
(Attributes::BURNING_TIME, 1f64),
(Attributes::CAMERA_DISTANCE, 4f64),
(Attributes::EXPLOSION_KNOCKBACK_RESISTANCE, 0f64),
(Attributes::ENTITY_INTERACTION_RANGE, 3f64),
(Attributes::FALL_DAMAGE_MULTIPLIER, 1f64),
(Attributes::GRAVITY, 0.08f64),
(Attributes::JUMP_STRENGTH, 0.41999998688697815f64),
(Attributes::KNOCKBACK_RESISTANCE, 0f64),
(Attributes::LUCK, 0f64),
(Attributes::MAX_ABSORPTION, 0f64),
(Attributes::MAX_HEALTH, 20f64),
(Attributes::MINING_EFFICIENCY, 0f64),
(Attributes::MOVEMENT_EFFICIENCY, 0f64),
(Attributes::MOVEMENT_SPEED, 0.10000000149011612f64),
(Attributes::OXYGEN_BONUS, 0f64),
(Attributes::SAFE_FALL_DISTANCE, 3f64),
(Attributes::SCALE, 1f64),
(Attributes::SNEAKING_SPEED, 0.3f64),
(Attributes::STEP_HEIGHT, 0.6f64),
(Attributes::SUBMERGED_MINING_SPEED, 0.2f64),
(Attributes::SWEEPING_DAMAGE_RATIO, 0f64),
(Attributes::WATER_MOVEMENT_EFFICIENCY, 0f64),
(Attributes::WAYPOINT_TRANSMIT_RANGE, 60000000f64),
(Attributes::WAYPOINT_RECEIVE_RANGE, 60000000f64),
],
hurt_sound: None,
attackable: None,
mob: false,
Expand Down
9 changes: 4 additions & 5 deletions pumpkin/src/entity/living.rs
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ impl LivingEntity {
}
m.insert(attr.id, AttributeInstance::new(*base));
}

std::sync::RwLock::new(m)
},
health: AtomicCell::new(max_health), // Initial health value from attributes
Expand Down Expand Up @@ -357,8 +358,7 @@ impl LivingEntity {
.attributes
.iter()
.find(|a| a.0.id == attribute.id)
.unwrap()
.1;
.map_or(attribute.default_value, |a| a.1);
AttributeInstance::new(base)
});

Expand All @@ -382,14 +382,13 @@ impl LivingEntity {
return instance.base_value;
}

// Fall back to registry base value if no local instance exists
// Fall back to registry base value, or the attribute's global default
self.entity
.entity_type
.attributes
.iter()
.find(|a| a.0.id == attribute.id)
.unwrap()
.1
.map_or(attribute.default_value, |a| a.1)
}

/// Update or insert the base value for an attribute on this entity.
Expand Down