aboutsummaryrefslogtreecommitdiffhomepage
path: root/Spigot-Server-Patches/0429-Fix-items-vanishing-through-end-portal.patch
blob: bb8a7a78287815577eb127b20efdca2aad75c25d (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
29
30
31
32
33
From e144e041f0047b0a0e867a0f793fe5ba8c8fd546 Mon Sep 17 00:00:00 2001
From: AJMFactsheets <AJMFactsheets@gmail.com>
Date: Wed, 22 Jan 2020 19:52:28 -0600
Subject: [PATCH] Fix items vanishing through end portal

If the Paper configuration option "keep-spawn-loaded" is set to false,
items entering the overworld from the end will spawn at Y = 0.

This is due to logic in the getHighestBlockYAt method in World.java
only searching the heightmap if the chunk is loaded.

Quickly loading the exact world spawn chunk before searching the
heightmap resolves the issue without having to load all spawn chunks.

diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index e8def7f8..f65db8e2 100644
--- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java
@@ -2591,6 +2591,11 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
 
         if (blockposition == null) { // CraftBukkit
             if (dimensionmanager1.getType() == DimensionManager.THE_END && dimensionmanager == DimensionManager.OVERWORLD) { // CraftBukkit
+                // Paper start - Ensure spawn chunk is always loaded before calculating Y coordinate
+                if (!worldserver1.isLoaded(worldserver1.getSpawn())) {
+                    worldserver1.getChunkAtWorldCoords(worldserver1.getSpawn());
+                }
+                // Paper end
                 blockposition = worldserver1.getHighestBlockYAt(HeightMap.Type.MOTION_BLOCKING_NO_LEAVES, worldserver1.getSpawn());
             } else if (dimensionmanager.getType() == DimensionManager.THE_END) { // CraftBukkit
                 blockposition = worldserver1.getDimensionSpawn();
-- 
2.17.1