spigot/CraftBukkit-Patches/0035-Save-ticks-lived-to-nbttag.patch

31 lines
1.5 KiB
Diff
Raw Normal View History

From 2d04fa76509e67b25b0c9d8b13d2ce08a56ca149 Mon Sep 17 00:00:00 2001
2014-04-12 14:18:37 +10:00
From: DerFlash <bte@freenet.de>
Date: Tue, 9 Jul 2013 00:11:12 +0200
Subject: [PATCH] Save ticks lived to nbttag
2021-03-16 09:00:00 +11:00
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
2022-03-01 02:00:00 +11:00
index 0221532df..d05e439b6 100644
2021-03-16 09:00:00 +11:00
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
2022-03-01 02:00:00 +11:00
@@ -1747,6 +1747,7 @@ public abstract class Entity implements INamableTileEntity, EntityAccess, IComma
2022-01-23 09:11:06 +11:00
if (maxAirTicks != getDefaultMaxAirSupply()) {
nbttagcompound.putInt("Bukkit.MaxAirSupply", getMaxAirSupply());
2020-08-26 18:38:43 +10:00
}
2021-11-22 09:00:00 +11:00
+ nbttagcompound.putInt("Spigot.ticksLived", this.tickCount);
2014-04-12 14:18:37 +10:00
// CraftBukkit end
2018-07-15 10:00:00 +10:00
IChatBaseComponent ichatbasecomponent = this.getCustomName();
2022-03-01 02:00:00 +11:00
@@ -1906,6 +1907,8 @@ public abstract class Entity implements INamableTileEntity, EntityAccess, IComma
2014-04-12 14:18:37 +10:00
if (this instanceof EntityLiving) {
EntityLiving entity = (EntityLiving) this;
2021-06-11 15:00:00 +10:00
+ this.tickCount = nbttagcompound.getInt("Spigot.ticksLived");
2014-04-12 14:18:37 +10:00
+
// Reset the persistence for tamed animals
if (entity instanceof EntityTameableAnimal && !isLevelAtLeast(nbttagcompound, 2) && !nbttagcompound.getBoolean("PersistenceRequired")) {
EntityInsentient entityinsentient = (EntityInsentient) entity;
--
2.25.1
2014-04-12 14:18:37 +10:00