diff options
author | Jakub Zacek <[email protected]> | 2024-07-15 23:35:51 +0200 |
---|---|---|
committer | GitHub <[email protected]> | 2024-07-15 17:35:51 -0400 |
commit | 2cd8c461af74f0a524878dcdffba86cd105c48c6 (patch) | |
tree | ac107a76fe3d6cdd2e6ef5804ef3cba152957e4c /patches/server/1018-Check-distance-in-entity-interactions.patch | |
parent | b57b24d549c65ddc5eb3edcc1ecc6aad2826dbd8 (diff) | |
download | Paper-2cd8c461af74f0a524878dcdffba86cd105c48c6.tar.gz Paper-2cd8c461af74f0a524878dcdffba86cd105c48c6.zip |
Add OMINOUS_ITEM_SPAWNER SpawnReason (#10897)
Diffstat (limited to 'patches/server/1018-Check-distance-in-entity-interactions.patch')
-rw-r--r-- | patches/server/1018-Check-distance-in-entity-interactions.patch | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/patches/server/1018-Check-distance-in-entity-interactions.patch b/patches/server/1018-Check-distance-in-entity-interactions.patch new file mode 100644 index 0000000000..64fd802e0e --- /dev/null +++ b/patches/server/1018-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 42d7ecfab6f72517904451d9df3f0404b176fdb2..0e38a641d8e537750166b56c57aca4a90d418af1 100644 +--- a/src/main/java/net/minecraft/Util.java ++++ b/src/main/java/net/minecraft/Util.java +@@ -125,6 +125,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 5deec2f7ab0f550b574b777f5a8eeb029f890dfd..8a876b2d964b70b9ddd2d90bf8fbb983566ef747 100644 +--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java ++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java +@@ -1437,7 +1437,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); +@@ -1557,6 +1557,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) { +@@ -2351,7 +2359,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/Boat.java b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +index 907f751c859855484151fb5d607acee2f2a35076..f1955afc8e367f80ead85bd5ad3b8d66c255565a 100644 +--- a/src/main/java/net/minecraft/world/entity/vehicle/Boat.java ++++ b/src/main/java/net/minecraft/world/entity/vehicle/Boat.java +@@ -718,7 +718,7 @@ public class Boat extends VehicleEntity implements Leashable, VariantHolder<Boat + 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; + } |