diff options
-rw-r--r-- | patches/server/1019-Check-distance-in-entity-interactions.patch (renamed from patches/server/1019-Improve-boat-collision-performance.patch) | 43 | ||||
-rw-r--r-- | patches/server/1023-Properly-resend-entities.patch | 4 |
2 files changed, 23 insertions, 24 deletions
diff --git a/patches/server/1019-Improve-boat-collision-performance.patch b/patches/server/1019-Check-distance-in-entity-interactions.patch index f1ba576e90..29a42b1b55 100644 --- a/patches/server/1019-Improve-boat-collision-performance.patch +++ b/patches/server/1019-Check-distance-in-entity-interactions.patch @@ -1,23 +1,23 @@ From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Spottedleaf <[email protected]> Date: Mon, 2 Aug 2021 10:10:40 +0200 -Subject: [PATCH] Improve boat collision performance +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..5869f2f5c72f736e6b077683327c64b9e0e0c733 100644 +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 - Improve boat collision performance ++ 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 eedbf5e73dcf4019f408a9098e020488d32ccf4c..ba4d69415a68442a93026c3ca9213f0fa44ca62e 100644 +index eedbf5e73dcf4019f408a9098e020488d32ccf4c..226148e763a9d63ac340a0b4dc07db3e3c5663b6 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 { @@ -25,37 +25,36 @@ index eedbf5e73dcf4019f408a9098e020488d32ccf4c..ba4d69415a68442a93026c3ca9213f0f Entity entity = source.getDirectEntity(); - if (entity instanceof LivingEntity) { -+ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Improve boat collision performance ++ if (entity instanceof LivingEntity && entity.distanceToSqr(this) <= (200.0D * 200.0D)) { // Paper - Check distance in entity interactions LivingEntity entityliving = (LivingEntity) entity; this.blockUsingShield(entityliving); -@@ -1547,8 +1547,13 @@ public abstract class LivingEntity extends Entity implements Attackable { - double d0 = 0.0D; - double d1 = 0.0D; - Entity entity2 = source.getDirectEntity(); -- -- if (entity2 instanceof Projectile) { -+ // Paper start - improve boat collision performance -+ final boolean far = entity2.distanceToSqr(this) > (200.0D * 200.0D); -+ if (far) { +@@ -1558,6 +1558,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(); -+ } else if (entity2 instanceof Projectile) { -+ // Paper end - improve boat collision performance - Projectile iprojectile = (Projectile) entity2; - DoubleDoubleImmutablePair doubledoubleimmutablepair = iprojectile.calculateHorizontalHurtKnockbackDirection(this, source); ++ } ++ // Paper end - Check distance in entity interactions -@@ -2352,7 +2357,7 @@ public abstract class LivingEntity extends Entity implements Attackable { + 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) { +@@ -2352,7 +2360,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 & improve boat collision performance ++ 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..edd30d872d151f953df28c8f6d40efa8d39f5e36 100644 +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 @@ -63,7 +62,7 @@ index 907f751c859855484151fb5d607acee2f2a35076..edd30d872d151f953df28c8f6d40efa8 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 - improve boat collision performance ++ 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; } diff --git a/patches/server/1023-Properly-resend-entities.patch b/patches/server/1023-Properly-resend-entities.patch index b1cbc31142..e1758c36c6 100644 --- a/patches/server/1023-Properly-resend-entities.patch +++ b/patches/server/1023-Properly-resend-entities.patch @@ -166,10 +166,10 @@ index f1fb4e830c6720d09b22056e3d0b9a08fe2bd472..83f3ffdd8fa901b3de580d2359cdb5ea public boolean equals(Object object) { return object instanceof Entity ? ((Entity) object).id == this.id : false; diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java -index ba4d69415a68442a93026c3ca9213f0fa44ca62e..c4b10ce2fd9f1e346aa9240e354b0583b90d2bdc 100644 +index 226148e763a9d63ac340a0b4dc07db3e3c5663b6..77d2d93966b99f3dfa2b47a505db74dd2dacfb1e 100644 --- a/src/main/java/net/minecraft/world/entity/LivingEntity.java +++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java -@@ -3877,6 +3877,11 @@ public abstract class LivingEntity extends Entity implements Attackable { +@@ -3880,6 +3880,11 @@ public abstract class LivingEntity extends Entity implements Attackable { return ((Byte) this.entityData.get(LivingEntity.DATA_LIVING_ENTITY_FLAGS) & 2) > 0 ? InteractionHand.OFF_HAND : InteractionHand.MAIN_HAND; } |