0
0
mirror of https://hub.spigotmc.org/stash/scm/spigot/spigot.git synced 2024-11-21 20:56:14 +00:00
spigot/CraftBukkit-Patches/0027-Save-ticks-lived-to-nbttag.patch
2024-10-23 02:15:00 +11:00

34 lines
1.6 KiB
Diff

From 45965c0f2c322088a5c191f2e14d79f86734cbad 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/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 30b473ca67..3d3ef96dc3 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2196,6 +2196,7 @@ public abstract class Entity implements SyncedDataHolder, INamableTileEntity, En
if (maxAirTicks != getDefaultMaxAirSupply()) {
nbttagcompound.putInt("Bukkit.MaxAirSupply", getMaxAirSupply());
}
+ nbttagcompound.putInt("Spigot.ticksLived", this.tickCount);
// CraftBukkit end
IChatBaseComponent ichatbasecomponent = this.getCustomName();
@@ -2355,6 +2356,11 @@ public abstract class Entity implements SyncedDataHolder, INamableTileEntity, En
}
// CraftBukkit start
+ // Spigot start
+ if (this instanceof EntityLiving) {
+ this.tickCount = nbttagcompound.getInt("Spigot.ticksLived");
+ }
+ // Spigot end
this.persist = !nbttagcompound.contains("Bukkit.persist") || nbttagcompound.getBoolean("Bukkit.persist");
this.visibleByDefault = !nbttagcompound.contains("Bukkit.visibleByDefault") || nbttagcompound.getBoolean("Bukkit.visibleByDefault");
// SPIGOT-6907: re-implement LivingEntity#setMaximumAir()
--
2.47.0