The Bug:
End crystals do the same damage across difficulties in 1.19.3. This also applies to TNT explosions.
This is what the damage looks like when you stand in the middle of one:
1.19.2 and previous versions:
Peaceful: 0 hp / 0 full hearts
Easy: 43.5 hp/ 21.75 full hearts
Normal: 85 hp / 42.5 full hearts
Hard: 127.5 hp / 63.75 full hearts
1.19.3:
Peaceful: 85 hp / 42.5 full hearts
Easy: 85 hp / 42.5hp full hearts
Normal: 85 hp / 42.5 hp full hearts
Hard: 85 hp / 42.5 hp full hearts
Steps to reproduce:
Set the difficulty to anything other than normal, such as hard, peaceful, or easy.
Spawn an end crystal.
Observe that the end crystal does the same damage as it would on normal difficulty.
Expected behavior:
The damage from an end crystal should do the same as on version 1.19.2 and before that.
Actual behavior:
The same damage that end crystals do on normal difficulty is the same as on other difficulties.
Code analysis:
Code analysis by @unknown can be found in this comment.
Linked issues
is duplicated by 2
relates to 2
Comments 4
Can no longer reproduce in 23w07a. This seems to have been fixed, at least for players.
Edit: This seems to have been fixed in 23w06a.
This should also be fixed for mobs, at least. People often use buffed zombies as dummies to practice Crystal PvP, so it's a shame that the lowered damage still applies for mobs.
This bug effects also affects other explosions in the game, such as TNT explosions. It doesn't affect bed and respawn anchor explosions (because their damage source is specified as a
BadRespawnPointDamageSource
withscaleWithDifficulty = true
) and creeper explosions (because it dies and thecausingEntity
isnull
).Code Analysis (yarn mappings):
Scaling damage with difficulty is done in the
damage
method of thePlayerEntity
class:Whether the damage is scaled is determined on if the
scaleWithDifficulty
field ofsource
is true. In thedamage
method of theEndCrystalEntity
class, these two lines handle the explosion:In the case of TNT lit by a player, it explodes without specifying the damage source, instead having a
getCausingEntity
method that is called inExplosion.getCausingEntity
which is called inDamageSource.explosion
which is called in theExplosion
constructor called inWorld.createExplosion
.In both these cases,
DamageSource.explosion
is called:Because both
attacker
andexplosion
are notnull
, aProjectileDamageSource
is created which extendsEntityDamageSource
which overrides theisScaledWithDifficulty
method inDamageSource
.Instead of
it's
This is done to have difficulty scaling apply only to mobs and not players. Since a player lit the TNT and a player hit the end crystal, this will be false, so the damage of the explosion will not be scaled.
Proposed Fix:
Change
EntityDamageSource.isScaledWithDifficulty
toThis shouldn't break anything to my knowledge.
Edit:
Because of MC-258561 and MC-157206 it's probably better to create a separate damage source for explosions instead of using the one for projectiles.