diff options
author | Nassim Jahnke <[email protected]> | 2024-12-11 12:13:51 +0100 |
---|---|---|
committer | Nassim Jahnke <[email protected]> | 2024-12-11 12:13:51 +0100 |
commit | 8dc76e715261f97bbf4a3f254e123aae08588ad5 (patch) | |
tree | 8022cecd70c4fcb899dbc49eca0d59390cc9b809 /patches/server/1054-Check-distance-in-entity-interactions.patch | |
parent | c17ef64339ab27e5e50f331e53b00f6de45f7444 (diff) | |
download | Paper-8dc76e715261f97bbf4a3f254e123aae08588ad5.tar.gz Paper-8dc76e715261f97bbf4a3f254e123aae08588ad5.zip |
[ci skip] Move back more
Diffstat (limited to 'patches/server/1054-Check-distance-in-entity-interactions.patch')
-rw-r--r-- | patches/server/1054-Check-distance-in-entity-interactions.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/patches/server/1054-Check-distance-in-entity-interactions.patch b/patches/server/1054-Check-distance-in-entity-interactions.patch new file mode 100644 index 0000000000..7e7ea01bc1 --- /dev/null +++ b/patches/server/1054-Check-distance-in-entity-interactions.patch @@ -0,0 +1,68 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: Spottedleaf <[email protected]> +Date: Mon, 2 Aug 2021 10:10:40 +0200 +Subject: [PATCH] Check distance in entity interactions + + +diff --git a/src/main/java/net/minecraft/Util.java b/src/main/java/net/minecraft/Util.java +index eb6a589280a433d915ad7c035b7ec4ddafb162a0..38ffa1c4c204f73746c4b87127de92b631548eb1 100644 +--- a/src/main/java/net/minecraft/Util.java ++++ b/src/main/java/net/minecraft/Util.java +@@ -129,6 +129,7 @@ public class Util { + .filter(fileSystemProvider -> fileSystemProvider.getScheme().equalsIgnoreCase("jar")) + .findFirst() + .orElseThrow(() -> new IllegalStateException("No jar file system provider found")); ++ public static final double COLLISION_EPSILON = 1.0E-7; // Paper - Check distance in entity interactions + private static Consumer<String> thePauser = message -> { + }; + +diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java +index e7092ec3e22a1236d8cb183859a2597ab0245631..d54f6f1f8ef4df5233478d6341f3181e8c1baace 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1467,7 +1467,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + if (!source.is(DamageTypeTags.IS_PROJECTILE)) { + Entity entity = source.getDirectEntity(); + +- if (entity instanceof LivingEntity) { ++ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Check distance in entity interactions + LivingEntity entityliving = (LivingEntity) entity; + + this.blockUsingShield(entityliving); +@@ -1563,6 +1563,14 @@ public abstract class LivingEntity extends Entity implements Attackable { + d0 = source.getSourcePosition().x() - this.getX(); + d1 = source.getSourcePosition().z() - this.getZ(); + } ++ // Paper start - Check distance in entity interactions; see for loop in knockback method ++ if (Math.abs(d0) > 200) { ++ d0 = Math.random() - Math.random(); ++ } ++ if (Math.abs(d1) > 200) { ++ d1 = Math.random() - Math.random(); ++ } ++ // Paper end - Check distance in entity interactions + + this.knockback(0.4000000059604645D, d0, d1, entity1, entity1 == null ? io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.DAMAGE : io.papermc.paper.event.entity.EntityKnockbackEvent.Cause.ENTITY_ATTACK); // CraftBukkit // Paper - knockback events + if (!flag) { +@@ -2476,7 +2484,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + this.hurtCurrentlyUsedShield((float) -event.getDamage(DamageModifier.BLOCKING)); + Entity entity = damagesource.getDirectEntity(); + +- if (!damagesource.is(DamageTypeTags.IS_PROJECTILE) && entity instanceof LivingEntity) { // Paper - Fix shield disable inconsistency ++ if (!damagesource.is(DamageTypeTags.IS_PROJECTILE) && entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Fix shield disable inconsistency & Check distance in entity interactions + this.blockUsingShield((LivingEntity) entity); + } + } +diff --git a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +index 8a5b3ebc875e5c71ca0d57a52e01b74cfee408b6..b87fd952020d88a6612429df73121422bf9ae422 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/AbstractBoat.java +@@ -674,7 +674,7 @@ public abstract class AbstractBoat extends VehicleEntity implements Leashable { + double d2 = (double) (this.getWaterLevelAbove() - this.getBbHeight()) + 0.101D; + + if (this.level().noCollision(this, this.getBoundingBox().move(0.0D, d2 - this.getY(), 0.0D))) { +- this.setPos(this.getX(), d2, this.getZ()); ++ this.move(MoverType.SELF, new Vec3(0.0D, d2 - this.getY(), 0.0D)); // Paper - Check distance in entity interactions // TODO Still needed?? + this.setDeltaMovement(this.getDeltaMovement().multiply(1.0D, 0.0D, 1.0D)); + this.lastYd = 0.0D; + } |