Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Damage outside LivingEntity

Verified against Minecraft 26.2 · Reference · Hand-kept from net/minecraft/world/entity/**.

Entity.hurtServer is abstract, so every branch has to answer for itself. (Entity.hurtClient, the other half of the pair, does have a default: it returns false, and twelve of the rows below inherit it unchanged.) The twenty-one classes are every non-LivingEntity class that declares Entity.hurtServer, and they answer with rules that share nothing with LivingEntity’s — no armour, no invulnerability window, no CombatTracker, no death sequence. The lecture that frames them is damage and death; this is the per-class table.

Two things happen before any of them. Player.cannotAttack asks Entity.isAttackable and then Entity.skipAttackInteraction, either of which can end the swing before the entity is asked anything — Interaction uses that hook to record who hit it and BlockAttachedEntity to re-enter through Entity.hurtOrSimulate with zero damage. Entity.hurtOrSimulate is what Player.attack calls, and it picks Entity.hurtServer or Entity.hurtClient off the level; its answer is not “did the hit land” but “was anything damaged”, and it is what gates the knockback, the sweep, the durability loss and the hit particles.

classwhat it checks firstwhat it doesreturns
AreaEffectCloudnothingfalse
Displaynothingfalse
Interactionnothing; the attacker was already recorded in Entity.skipAttackInteractionfalse
LightningBoltnothingfalse
Markernothingfalse
OminousItemSpawnernothingfalse
PrimedTntnothing: a lit TNT block cannot be shot out of the airfalse
EvokerFangsnothingfalse
EyeOfEndernothingfalse
AbstractHurtingProjectilenothing — but a fireball or a wind charge is deflected before this is reached, since Player.attack calls Player.deflectProjectile first for anything in EntityTypeTags.REDIRECTABLE_PROJECTILE; the rest are unhittable by Entity.isPickablefalse
ProjectileEntity.isInvulnerableToBaseEntity.markHurt only, so the client sees a flinch and nothing changesfalse
FallingBlockEntityEntity.isInvulnerableToBaseEntity.markHurt onlyfalse
ExperienceOrbEntity.isInvulnerableToBasesubtracts the damage from an int of health, Entity.discard at zerotrue
ItemEntityEntity.isInvulnerableToBase, then a Mob source under GameRules.MOB_GRIEFING, then ItemStack.canBeHurtBysame int of health, plus GameEvent.ENTITY_DAMAGE, and ItemStack.onDestroyed before the discardtrue
BlockAttachedEntityEntity.isInvulnerableToBase, then a Mob source under GameRules.MOB_GRIEFINGEntity.kill, Entity.markHurt, and drops its item — one hit, whatever the amounttrue
ItemFrameItemFrame.fixed gates everything: a fixed frame is hurt only by DamageTypeTags.BYPASSES_INVULNERABILITY or a creative playera non-explosion hit on a frame holding something pops the item and stops there; otherwise it falls through to BlockAttachedEntity and the frame breakstrue
EndCrystalEntity.isInvulnerableToBase, then is the source an EnderDragonremoves itself with Entity.RemovalReason.KILLED and explodes with power 6 — unless the source was already an explosion — then EndCrystal.onDestroyedBytrue
ShulkerBulletplays SoundEvents.SHULKER_BULLET_HURT, spawns fifteen ParticleTypes.CRIT, destroys itselftrue
EnderDragonPartEntity.isInvulnerableToBaseforwards the whole call to EnderDragon.hurt with itself as the part that was hitthe parent’s answer
VehicleEntityalready removed, then Entity.isInvulnerableToBaseflips VehicleEntity.getHurtDir, sets ten ticks of hurt time, adds damage × 10 to VehicleEntity.getDamage, and destroys past 40 — a creative player skips to Entity.discardtrue
MinecartTNTa burning AbstractArrow as the direct entity explodes it, scaled by the arrow’s speedon that path, nothing else: the explosion calls Entity.discard, so VehicleEntity.hurtServer returns at its already-removed test. Any other source falls through to everything VehicleEntity doestrue

Six patterns account for all of it: nothing happens (ten classes), a flinch and nothing else (two), an int of health with no armour and no window (two), one hit destroys (four), an accumulator (two), and forward it to something else (one, the dragon part). The classes that read the damage amount at all are the pair with an int of health, the accumulator pair, and EnderDragonPart, which hands the number to the dragon; everything else is a yes-or-no.


Rules: names, never code · how the system works, not how the code reads · newest version only · every backticked name passes tools/verify_names.py.