Skip to content

Commit

Permalink
fix: Copy special case for TNT height from Minecraft's explosion code (
Browse files Browse the repository at this point in the history
  • Loading branch information
2No2Name authored Jul 3, 2020
1 parent 1b24c05 commit 268a24a
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import net.minecraft.enchantment.ProtectionEnchantment;
import net.minecraft.entity.Entity;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.TntEntity;
import net.minecraft.entity.damage.DamageSource;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.FluidState;
Expand Down Expand Up @@ -288,7 +289,9 @@ private void damageEntities() {
}

double distXSq = entity.getX() - this.x;
double distYSq = entity.getEyeY() - this.y;
// [VanillaCopy] In the 1.16 snapshots Mojang added this distinction between TNT and other entities in the explosion code to
// fix the the increased eye height affecting explosions. The eye height increase was an attempt to fix rendering of tnt on soulsand.
double distYSq = (entity instanceof TntEntity ? entity.getY() : entity.getEyeY()) - this.y;
double distZSq = entity.getZ() - this.z;

double dist = MathHelper.sqrt((distXSq * distXSq) + (distYSq * distYSq) + (distZSq * distZSq));
Expand Down

0 comments on commit 268a24a

Please sign in to comment.