--- a/net/minecraft/world/level/chunk/storage/EntityStorage.java
+++ b/net/minecraft/world/level/chunk/storage/EntityStorage.java
@@ -28,10 +_,10 @@
     private static final Logger LOGGER = LogUtils.getLogger();
     private static final String ENTITIES_TAG = "Entities";
     private static final String POSITION_TAG = "Position";
-    private final ServerLevel level;
+    public final ServerLevel level;
     private final SimpleRegionStorage simpleRegionStorage;
     private final LongSet emptyChunks = new LongOpenHashSet();
-    private final ConsecutiveExecutor entityDeserializerQueue;
+    public final ConsecutiveExecutor entityDeserializerQueue;
 
     public EntityStorage(SimpleRegionStorage simpleRegionStorage, ServerLevel level, Executor executor) {
         this.simpleRegionStorage = simpleRegionStorage;
@@ -71,12 +_,12 @@
         }
     }
 
-    private static ChunkPos readChunkPos(CompoundTag tag) {
+    public static ChunkPos readChunkPos(CompoundTag tag) { // Paper - public
         int[] intArray = tag.getIntArray("Position");
         return new ChunkPos(intArray[0], intArray[1]);
     }
 
-    private static void writeChunkPos(CompoundTag tag, ChunkPos pos) {
+    public static void writeChunkPos(CompoundTag tag, ChunkPos pos) { // Paper - public
         tag.put("Position", new IntArrayTag(new int[]{pos.x, pos.z}));
     }
 
@@ -93,7 +_,18 @@
             }
         } else {
             ListTag listTag = new ListTag();
+            final java.util.Map<net.minecraft.world.entity.EntityType<?>, Integer> savedEntityCounts = new java.util.HashMap<>(); // Paper - Entity load/save limit per chunk
             entities.getEntities().forEach(entity -> {
+                // Paper start - Entity load/save limit per chunk
+                final EntityType<?> entityType = entity.getType();
+                final int saveLimit = this.level.paperConfig().chunks.entityPerChunkSaveLimit.getOrDefault(entityType, -1);
+                if (saveLimit > -1) {
+                    if (savedEntityCounts.getOrDefault(entityType, 0) >= saveLimit) {
+                        return;
+                    }
+                    savedEntityCounts.merge(entityType, 1, Integer::sum);
+                }
+                // Paper end - Entity load/save limit per chunk
                 CompoundTag compoundTag1 = new CompoundTag();
                 if (entity.save(compoundTag1)) {
                     listTag.add(compoundTag1);
