--- a/net/minecraft/world/level/entity/EntitySectionStorage.java
+++ b/net/minecraft/world/level/entity/EntitySectionStorage.java
@@ -34,6 +_,16 @@
         this.intialSectionVisibility = initialSectionVisibility;
     }
 
+    // Paper start - support retrieving all entities, regardless of whether they are accessible
+    public Iterable<T> getAllEntities() {
+        java.util.List<T> ret = new java.util.ArrayList<>();
+        for (EntitySection<T> section : this.sections.values()) {
+            section.getEntities(ret);
+        }
+        return ret;
+    }
+    // Paper end - support retrieving all entities, regardless of whether they are accessible
+
     public void forEachAccessibleNonEmptySection(AABB boundingBox, AbortableIterationConsumer<EntitySection<T>> consumer) {
         int sectionPosCoord = SectionPos.posToSectionCoord(boundingBox.minX - 2.0);
         int sectionPosCoord1 = SectionPos.posToSectionCoord(boundingBox.minY - 4.0);
