Paper/patches/server/0411-Ensure-safe-gateway-teleport.patch
2022-12-07 21:16:54 +01:00

27 lines
1.4 KiB
Diff

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 1c0c1be2b08fc8a28ff36896da01d668308570f4..f80545f80948db27d1fbde77d0505c916eb504ed 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
+ for (Entity entity : list) {
+ if (entity.canChangeDimensions()) {
+ TheEndGatewayBlockEntity.teleportEntity(world, pos, state, entity, blockEntity);
+ break;
+ }
+ }
+ // Paper end
}
if (blockEntity.age % 2400L == 0L) {