Paper/patches/server/0285-Reset-players-airTicks-on-respawn.patch
2021-06-15 21:53:50 -07:00

31 lines
1.4 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: GreenMeanie <GreenMeanieMC@gmail.com>
Date: Sat, 20 Oct 2018 22:34:02 -0400
Subject: [PATCH] Reset players airTicks on respawn
diff --git a/src/main/java/net/minecraft/server/level/ServerPlayer.java b/src/main/java/net/minecraft/server/level/ServerPlayer.java
index 3ca3a1c16ea0900bfb868a6e2fc88e3522bf7752..8beca0412c65ad03376fb76e2d993bc841bf9e0b 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2210,6 +2210,7 @@ public class ServerPlayer extends Player {
}
this.setHealth(this.getMaxHealth());
+ this.setAirSupply(this.getMaxAirTicks()); // Paper
this.remainingFireTicks = 0;
this.fallDistance = 0;
this.foodData = new FoodData(this);
diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java
index 0680ed44a47cfafdff400dd3033c9600afd3514b..62bb61b6f8e099eddf3ad12b7ff47f62cab2eaa9 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2587,6 +2587,7 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource, n
}
+ public final int getMaxAirTicks() { return getMaxAirSupply(); } // Paper - OBFHELPER
public int getMaxAirSupply() {
return 300;
}