aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0375-Ensure-safe-gateway-teleport.patch
blob: cf80905d38e5926927ac5c0e84e39450b93347e5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: kickash32 <kickash32@gmail.com>
Date: Fri, 15 May 2020 01:10:03 -0400
Subject: [PATCH] Ensure safe gateway teleport


diff --git a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
index a57743b21b6075ba01def0a41fecbf90b2df7f85..54f7bdd0e003ed170d739593199a2bb8ff0bbd68 100644
--- a/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
+++ b/src/main/java/net/minecraft/world/level/block/entity/TheEndGatewayBlockEntity.java
@@ -106,7 +106,14 @@ public class TheEndGatewayBlockEntity extends TheEndPortalBlockEntity {
             List<Entity> list = world.getEntitiesOfClass(Entity.class, new AABB(pos), TheEndGatewayBlockEntity::canEntityTeleport);
 
             if (!list.isEmpty()) {
-                TheEndGatewayBlockEntity.teleportEntity(world, pos, state, (Entity) list.get(world.random.nextInt(list.size())), blockEntity);
+                // Paper start - Ensure safe gateway teleport
+                for (Entity entity : list) {
+                    if (entity.canChangeDimensions()) {
+                        TheEndGatewayBlockEntity.teleportEntity(world, pos, state, entity, blockEntity);
+                        break;
+                    }
+                }
+                // Paper end - Ensure safe gateway teleport
             }
 
             if (blockEntity.age % 2400L == 0L) {