aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0494-Ensure-safe-gateway-teleport.patch
blob: af8fb316e39966f6cef69c1d8f3e08417a27ac72 (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
27
28
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/server/TileEntityEndGateway.java b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
index ea61a473d8e47428ed5cd4541a5855f0e2c50815..ce239d2b2fe942915aa093b86343c3740d10e273 100644
--- a/src/main/java/net/minecraft/server/TileEntityEndGateway.java
+++ b/src/main/java/net/minecraft/server/TileEntityEndGateway.java
@@ -62,10 +62,14 @@ public class TileEntityEndGateway extends TileEntityEnderPortal implements ITick
             --this.c;
         } else if (!this.world.isClientSide) {
             List<Entity> list = this.world.a(Entity.class, new AxisAlignedBB(this.getPosition()));
-
-            if (!list.isEmpty()) {
-                this.a((Entity) list.get(this.world.random.nextInt(list.size())));
+            // Paper start
+            for (Entity entity : list) {
+                if (entity.canPortal()) {
+                    this.a(entity);
+                    break;
+                }
             }
+            // Paper end
 
             if (this.age % 2400L == 0L) {
                 this.h();