Skip to content

Commit

Permalink
fix: correct explosion damage calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
smartcmd committed Jan 23, 2025
1 parent ba1fb19 commit e4cb2c0
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 3 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Unless otherwise specified, any version comparison below is the comparison of se
- Plugins are able to create their own world generator implementation now. In previous versions a ClassCastException would be thrown when
initializing the dimension.
- Explosion now calculates entity exposure correctly. In previous version any non-air block will block the explosion ray.
- Explosion damage now scales with game difficulty, and a bug was fixed that cause the damage two times bigger than the correct damage.
- Explosion damage now scales with game difficulty.
- Fixed a rare NPE exception that may occur if player disconnect when joining the server.

### Removed
Expand Down
3 changes: 1 addition & 2 deletions api/src/main/java/org/allaymc/api/world/Explosion.java
Original file line number Diff line number Diff line change
Expand Up @@ -222,8 +222,7 @@ public void explode(Dimension dimension, float x, float y, float z) {
case NORMAL -> 7.0f;
case HARD -> 10.5f;
};
var power = size / 2.0f;
var damage = (float) Math.floor((impact * impact + impact) * m * power + 1.0f);
var damage = (impact * impact + impact) * m * size / 2.0f + 1.0f;
if (entity == null) {
damageComponent.attack(DamageContainer.blockExplosion(damage));
} else {
Expand Down

0 comments on commit e4cb2c0

Please sign in to comment.