Always try to load entity origin location from new NBT tag

This commit is contained in:
Byteflux
2016-03-25 09:32:09 -07:00
parent ced183982a
commit 5bd7a9ab62
4 changed files with 15 additions and 17 deletions

View File

@@ -1,11 +1,11 @@
From bfa2721aa0e6c9406977d18b648f2eae3d082109 Mon Sep 17 00:00:00 2001
From 81278a4d41700b713cb97c818585210855c54d41 Mon Sep 17 00:00:00 2001
From: Byteflux <byte@byteflux.net>
Date: Tue, 1 Mar 2016 23:45:08 -0600
Subject: [PATCH] Entity Origin API
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index f4b9481..eaaca75 100644
index f4b9481..cf1278d 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -142,6 +142,7 @@ public abstract class Entity implements ICommandListener {
@@ -28,16 +28,14 @@ index f4b9481..eaaca75 100644
} catch (Throwable throwable) {
CrashReport crashreport = CrashReport.a(throwable, "Saving entity NBT");
CrashReportSystemDetails crashreportsystemdetails = crashreport.a("Entity being saved");
@@ -1480,6 +1486,15 @@ public abstract class Entity implements ICommandListener {
@@ -1480,6 +1486,13 @@ public abstract class Entity implements ICommandListener {
}
// CraftBukkit end
+ // Paper start - Restore the entity's origin location
+ if (origin == null) {
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
+ if (!originTag.isEmpty()) {
+ origin = new Location(world.getWorld(), originTag.e(0), originTag.e(1), originTag.e(2));
+ }
+ NBTTagList originTag = nbttagcompound.getList("Paper.Origin", 6);
+ if (!originTag.isEmpty()) {
+ origin = new Location(world.getWorld(), originTag.e(0), originTag.e(1), originTag.e(2));
+ }
+ // Paper end
+