From 08aaee1b77ae485ee0fec32204bf41783f854fcd Mon Sep 17 00:00:00 2001
From: BillyGalbreath <Blake.Galbreath@GMail.com>
Date: Mon, 31 Jul 2017 01:54:40 -0500
Subject: [PATCH] Ocelot despawns should honor nametags and leash

---
 .../net/minecraft/world/entity/animal/Ocelot.java.patch  | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/Ocelot.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/Ocelot.java.patch
index 1b6fb2d654..e217641cf1 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/animal/Ocelot.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/Ocelot.java.patch
@@ -1,5 +1,14 @@
 --- a/net/minecraft/world/entity/animal/Ocelot.java
 +++ b/net/minecraft/world/entity/animal/Ocelot.java
+@@ -132,7 +132,7 @@
+ 
+     @Override
+     public boolean removeWhenFarAway(double distanceSquared) {
+-        return !this.isTrusting() && this.tickCount > 2400;
++        return !this.isTrusting() && this.tickCount > 2400 && !this.hasCustomName() && !this.isLeashed(); // Paper - honor name and leash
+     }
+ 
+     public static AttributeSupplier.Builder createAttributes() {
 @@ -167,7 +167,7 @@
          if ((this.temptGoal == null || this.temptGoal.isRunning()) && !this.isTrusting() && this.isFood(itemstack) && player.distanceToSqr((Entity) this) < 9.0D) {
              this.usePlayerItem(player, hand, itemstack);