server/entity: share the living-entity foundation with the player - #1452
Open
EinBexiii wants to merge 23 commits into
Open
server/entity: share the living-entity foundation with the player#1452EinBexiii wants to merge 23 commits into
EinBexiii wants to merge 23 commits into
Conversation
…ed submersion checks
Fall and TickOnFire each named an interface inline in their signature, which reads as noise and cannot be satisfied on purpose. Both want the same small thing, an entity that may be hurt, so it is Hurtable now, with FlammableEntity adding what the fire tick needs on top. CheckEntityLanders returns the distance it resolved rather than writing through a pointer, and Ent.Unwrap is Ent.Base: Unwrap reads as error unwrapping in Go, and this returns the embedded base.
EinBexiii
force-pushed
the
pr/entity-refactor
branch
2 times, most recently
from
August 30, 2026 16:50
dd8f700 to
5eed4a3
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the substance of #1450, with the bug fixes and the UI change pulled out into their own PRs.
A player is an entity, but almost nothing that makes an entity alive sits on the entity side. Damage, armour, effects, air, fall handling, fire ticks, knockback and attack immunity all live on Player, and it's the same logic anything else alive would need, so anything that isn't a player has to duplicate it and the two copies drift apart. This moves that into shared pieces and has the player use them like anything else would: LivingEnt and LivingState as a base, AirSupply and AttackImmunity as components to embed, and FinalDamage, KnockBackVector, ExplosionDamage and Fall as plain functions. Living splits into Damageable and EffectBearer, and player.go gets a good deal shorter along the way.
HandleEntityHurt comes with it because it can't go in alone. There's no single place entity damage passes through upstream, since Hurt sits on Living and every entity implements it itself, so the hook would have nothing to hook into. The shared damage path is what gives it one.