Paper/patches/server/0107-Auto-fix-bad-Y-levels-on-player-login.patch

20 Zeilen
1.1 KiB
Diff

2021-06-11 14:02:28 +02:00
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Aikar <aikar@aikar.co>
Date: Wed, 21 Sep 2016 23:48:39 -0400
Subject: [PATCH] Auto fix bad Y levels on player login
Bring down to a saner Y level if super high, as this can cause the server to crash
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2021-07-07 08:52:40 +02:00
index a21496bc07c4691b99f9f58a0493e6e054c02641..d5bdf1e58bf48b5738e98159afb54630220af5b0 100644
2021-06-11 14:02:28 +02:00
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
2021-07-07 08:52:40 +02:00
@@ -397,6 +397,7 @@ public class ServerPlayer extends Player {
2021-06-11 14:02:28 +02:00
@Override
2021-06-12 08:02:49 +02:00
public void readAdditionalSaveData(CompoundTag nbt) {
super.readAdditionalSaveData(nbt);
2021-06-11 14:02:28 +02:00
+ if (this.getY() > 300) this.setPosRaw(getX(), 257, getZ()); // Paper - bring down to a saner Y level if out of world
2021-06-12 08:02:49 +02:00
if (nbt.contains("enteredNetherPosition", 10)) {
CompoundTag nbttagcompound1 = nbt.getCompound("enteredNetherPosition");