mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-28 23:38:25 +01:00
69ee95fa42
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 Penilla <11360596+jpenilla@users.noreply.github.com> Co-authored-by: Riley Park <rileysebastianpark@gmail.com> Co-authored-by: Aurora <21148213+aurorasmiles@users.noreply.github.com> Co-authored-by: Nassim Jahnke <nassim@njahnke.dev> Co-authored-by: commandblockguy <commandblockguy1@gmail.com> Co-authored-by: DigitalRegent <misterwener@gmail.com> Co-authored-by: ishland <ishlandmc@yeah.net>
99 lines
4.6 KiB
Diff
99 lines
4.6 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Aikar <aikar@aikar.co>
|
|
Date: Mon, 28 Mar 2016 21:22:26 -0400
|
|
Subject: [PATCH] EntityPathfindEvent
|
|
|
|
Fires when an Entity decides to start moving to a location.
|
|
|
|
diff --git a/src/main/java/net/minecraft/server/Navigation.java b/src/main/java/net/minecraft/server/Navigation.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/Navigation.java
|
|
+++ b/src/main/java/net/minecraft/server/Navigation.java
|
|
@@ -0,0 +0,0 @@ public class Navigation extends NavigationAbstract {
|
|
|
|
@Override
|
|
public PathEntity a(Entity entity, int i) {
|
|
- return this.a(entity.getChunkCoordinates(), i);
|
|
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
|
}
|
|
|
|
private int t() {
|
|
diff --git a/src/main/java/net/minecraft/server/NavigationAbstract.java b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
+++ b/src/main/java/net/minecraft/server/NavigationAbstract.java
|
|
@@ -0,0 +0,0 @@ import javax.annotation.Nullable;
|
|
|
|
public abstract class NavigationAbstract {
|
|
|
|
- protected final EntityInsentient a;
|
|
+ protected final EntityInsentient a; public Entity getEntity() { return a; } // Paper - OBFHELPER
|
|
protected final World b;
|
|
@Nullable
|
|
protected PathEntity c;
|
|
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
|
|
|
@Nullable
|
|
public PathEntity a(BlockPosition blockposition, int i) {
|
|
- return this.a(ImmutableSet.of(blockposition), 8, false, i);
|
|
+ // Paper start - add target parameter
|
|
+ return this.a(blockposition, null, i);
|
|
+ }
|
|
+ @Nullable public PathEntity a(BlockPosition blockposition, Entity target, int i) {
|
|
+ return this.a(ImmutableSet.of(blockposition), target, 8, false, i);
|
|
+ // Paper end
|
|
}
|
|
|
|
@Nullable
|
|
public PathEntity a(Entity entity, int i) {
|
|
- return this.a(ImmutableSet.of(entity.getChunkCoordinates()), 16, true, i);
|
|
+ return this.a(ImmutableSet.of(entity.getChunkCoordinates()), entity, 16, true, i); // Paper
|
|
}
|
|
|
|
@Nullable
|
|
+ // Paper start - Add target
|
|
protected PathEntity a(Set<BlockPosition> set, int i, boolean flag, int j) {
|
|
+ return this.a(set, null, i, flag, j);
|
|
+ }
|
|
+ @Nullable protected PathEntity a(Set<BlockPosition> set, Entity target, int i, boolean flag, int j) {
|
|
+ // Paper end
|
|
if (set.isEmpty()) {
|
|
return null;
|
|
} else if (this.a.locY() < 0.0D) {
|
|
@@ -0,0 +0,0 @@ public abstract class NavigationAbstract {
|
|
} else if (this.c != null && !this.c.c() && set.contains(this.p)) {
|
|
return this.c;
|
|
} else {
|
|
+ // Paper start - Pathfind event
|
|
+ boolean copiedSet = false;
|
|
+ for (BlockPosition possibleTarget : set) {
|
|
+ if (!new com.destroystokyo.paper.event.entity.EntityPathfindEvent(getEntity().getBukkitEntity(),
|
|
+ MCUtil.toLocation(getEntity().world, possibleTarget), target == null ? null : target.getBukkitEntity()).callEvent()) {
|
|
+ if (!copiedSet) {
|
|
+ copiedSet = true;
|
|
+ set = new java.util.HashSet<>(set);
|
|
+ }
|
|
+ // note: since we copy the set this remove call is safe, since we're iterating over the old copy
|
|
+ set.remove(possibleTarget);
|
|
+ if (set.isEmpty()) {
|
|
+ return null;
|
|
+ }
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
this.b.getMethodProfiler().enter("pathfind");
|
|
float f = (float) this.a.b(GenericAttributes.FOLLOW_RANGE);
|
|
BlockPosition blockposition = flag ? this.a.getChunkCoordinates().up() : this.a.getChunkCoordinates();
|
|
diff --git a/src/main/java/net/minecraft/server/NavigationFlying.java b/src/main/java/net/minecraft/server/NavigationFlying.java
|
|
index 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
|
|
--- a/src/main/java/net/minecraft/server/NavigationFlying.java
|
|
+++ b/src/main/java/net/minecraft/server/NavigationFlying.java
|
|
@@ -0,0 +0,0 @@ public class NavigationFlying extends NavigationAbstract {
|
|
|
|
@Override
|
|
public PathEntity a(Entity entity, int i) {
|
|
- return this.a(entity.getChunkCoordinates(), i);
|
|
+ return this.a(entity.getChunkCoordinates(), entity, i); // Paper - Forward target entity
|
|
}
|
|
|
|
@Override
|