From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Spottedleaf <spottedleaf@spottedleaf.dev>
Date: Thu, 10 Dec 2020 15:35:43 -0800
Subject: [PATCH] Copy passenger list in enderTeleportTo

Fixes https://github.com/Spottedleaf/Tuinity/issues/208

diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index 1b56d83bdac536e8189901f03ad58e82d33ac8a3..50c61b633faaa47a86172315b53899d3747c8e27 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -3084,7 +3084,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
             this.recursiveStream().forEach((entity) -> {
                 worldserver.chunkCheck(entity);
                 entity.az = true;
-                Iterator iterator = entity.passengers.iterator();
+                Iterator iterator = new java.util.ArrayList<>(entity.passengers).iterator(); // Tuinity - copy list to guard against CME
 
                 while (iterator.hasNext()) {
                     Entity entity1 = (Entity) iterator.next();
