From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: William Blake Galbreath <Blake.Galbreath@GMail.com>
Date: Tue, 18 Feb 2020 20:07:08 -0600
Subject: [PATCH] Add canSaveToDisk to Entity


diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 7c9fc120d2b58ca969b8a0ff9619e96f4f34b1c4..4e6ec59c982fe0870f514b59082ab0a7de4d93ef 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -416,6 +416,12 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, ne
         this.headHeight = this.getHeadHeight(EntityPose.STANDING, this.size);
     }
 
+    // Purpur start
+    public boolean canSaveToDisk() {
+        return true;
+    }
+    // Purpur end
+
     public boolean isSpectator() {
         return false;
     }
diff --git a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
index bf96f9e538fc29ca914536e8a7ce727ebe43a8b2..5997f3e47f3d509c271f38eb2785f126066f5c6e 100644
--- a/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
+++ b/src/main/java/net/minecraft/world/level/chunk/storage/ChunkRegionLoader.java
@@ -582,6 +582,7 @@ public class ChunkRegionLoader {
 
                 while (iterator1.hasNext()) {
                     Entity entity = (Entity) iterator1.next();
+                    if (!entity.canSaveToDisk()) continue; // Purpur
                     final EntityTypes<?> entityType = entity.getEntityType();
                     final int saveLimit = worldserver.paperConfig.entityPerChunkSaveLimits.getOrDefault(entityType, -1);
                     if (saveLimit > -1) {
