spigot/CraftBukkit-Patches/0049-Save-ticks-lived-to-nbttag.patch
2017-11-17 10:24:35 +11:00

30 lines
1.6 KiB
Diff

From 0b9a594bea82d50e49b31bcb542a006ee082bb55 Mon Sep 17 00:00:00 2001
From: DerFlash <bte@freenet.de>
Date: Tue, 9 Jul 2013 00:11:12 +0200
Subject: [PATCH] Save ticks lived to nbttag
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index d96a76ca0..ad86f0ff4 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1487,6 +1487,7 @@ public abstract class Entity implements ICommandListener {
nbttagcompound.setLong("WorldUUIDLeast", this.world.getDataManager().getUUID().getLeastSignificantBits());
nbttagcompound.setLong("WorldUUIDMost", this.world.getDataManager().getUUID().getMostSignificantBits());
nbttagcompound.setInt("Bukkit.updateLevel", CURRENT_LEVEL);
+ nbttagcompound.setInt("Spigot.ticksLived", this.ticksLived);
// CraftBukkit end
if (this.hasCustomName()) {
nbttagcompound.setString("CustomName", this.getCustomName());
@@ -1638,6 +1639,8 @@ public abstract class Entity implements ICommandListener {
if (this instanceof EntityLiving) {
EntityLiving entity = (EntityLiving) this;
+ this.ticksLived = nbttagcompound.getInt("Spigot.ticksLived");
+
// Reset the persistence for tamed animals
if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
--
2.14.1