mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-03 06:40:19 +08:00
c97ce029e9
PaperMC believes that 1.16.2 is now ready for general release as we fixed the main issue plagueing the 1.16.x release, the MapLike data conversion issues. Until now, it was not safe for a server to convert a world to 1.16.2 without data conversion issues around villages and potentially other things. If you did, those MapLike errors meant something went wrong. This is now resolved. Big thanks to all those that helped, notably @BillyGalbreath and @Proximyst who did large parts of the update process with me. Please as always, backup your worlds and test before updating to 1.16.2! If you update to 1.16.2, there is no going back to an older build than this. --------------------------------- Co-authored-by: William Blake Galbreath <Blake.Galbreath@GMail.com> Co-authored-by: Mariell Hoversholm <proximyst@proximyst.com> Co-authored-by: krolik-exe <69214078+krolik-exe@users.noreply.github.com> Co-authored-by: BillyGalbreath <BillyGalbreath@users.noreply.github.com> Co-authored-by: stonar96 <minecraft.stonar96@gmail.com> Co-authored-by: Shane Freeder <theboyetronic@gmail.com> Co-authored-by: Jason <jasonpenilla2@me.com> Co-authored-by: kashike <kashike@vq.lc> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: KennyTV <kennytv@t-online.de> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
65 lines
3.3 KiB
Diff
65 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
|
|
Date: Wed, 18 Dec 2019 22:21:35 -0600
|
|
Subject: [PATCH] MC-145656 Fix Follow Range Initial Target
|
|
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
index 06ed45f35025a0ce16ff80fa4316d8da98ed3c6a..b94c8e33780e10e458951384ffc49bd7fb015a6b 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperWorldConfig.java
|
|
@@ -566,4 +566,9 @@ public class PaperWorldConfig {
|
|
private void pillagerSettings() {
|
|
disablePillagerPatrols = getBoolean("game-mechanics.disable-pillager-patrols", disablePillagerPatrols);
|
|
}
|
|
+
|
|
+ public boolean entitiesTargetWithFollowRange = false;
|
|
+ private void entitiesTargetWithFollowRange() {
|
|
+ entitiesTargetWithFollowRange = getBoolean("entities-target-with-follow-range", entitiesTargetWithFollowRange);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
|
|
index 25a67f91e487d80d3996cc8b2544fece55059590..c0721c7fe479c8f753b8f48197a70dcd1ecfef5f 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderGoalNearestAttackableTarget.java
|
|
@@ -25,6 +25,7 @@ public class PathfinderGoalNearestAttackableTarget<T extends EntityLiving> exten
|
|
this.b = i;
|
|
this.a(EnumSet.of(PathfinderGoal.Type.TARGET));
|
|
this.d = (new PathfinderTargetCondition()).a(this.k()).a(predicate);
|
|
+ if (entityinsentient.world.paperConfig.entitiesTargetWithFollowRange) this.d.useFollowRange(); // Paper
|
|
}
|
|
|
|
@Override
|
|
diff --git a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
|
index 174464273d1069ea07f12aaea116206366bad89f..253377c6238594de1f76cafcbf8223592e4d3f6b 100644
|
|
--- a/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
|
+++ b/src/main/java/net/minecraft/server/PathfinderTargetCondition.java
|
|
@@ -80,7 +80,7 @@ public class PathfinderTargetCondition {
|
|
|
|
if (this.b > 0.0D) {
|
|
double d0 = this.g ? entityliving1.A(entityliving) : 1.0D;
|
|
- double d1 = Math.max(this.b * d0, 2.0D);
|
|
+ double d1 = Math.max((useFollowRange ? getFollowRange(entityliving) : this.b) * d0, 2.0D); // Paper
|
|
double d2 = entityliving.h(entityliving1.locX(), entityliving1.locY(), entityliving1.locZ());
|
|
|
|
if (d2 > d1 * d1) {
|
|
@@ -96,4 +96,18 @@ public class PathfinderTargetCondition {
|
|
return true;
|
|
}
|
|
}
|
|
+
|
|
+ // Paper start
|
|
+ private boolean useFollowRange = false;
|
|
+
|
|
+ public PathfinderTargetCondition useFollowRange() {
|
|
+ this.useFollowRange = true;
|
|
+ return this;
|
|
+ }
|
|
+
|
|
+ private double getFollowRange(EntityLiving entityliving) {
|
|
+ AttributeModifiable attributeinstance = entityliving.getAttributeInstance(GenericAttributes.FOLLOW_RANGE);
|
|
+ return attributeinstance == null ? 16.0D : attributeinstance.getValue();
|
|
+ }
|
|
+ // Paper end
|
|
}
|