PaperMC/patches/server-remapped/0305-Reset-players-airTicks-on-respawn.patch

31 lines
1.5 KiB
Diff
Raw Normal View History

2021-06-11 14:02:28 +02:00
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 92139b271eb6c305787662ef8c7d221fb42296f7..b68acf219fc61e2ea811d0c732393824fa44db2d 100644
--- a/src/main/java/net/minecraft/server/level/ServerPlayer.java
+++ b/src/main/java/net/minecraft/server/level/ServerPlayer.java
@@ -2159,6 +2159,7 @@ public class ServerPlayer extends Player implements ContainerListener {
}
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 e7fed1f8bb8ffb164ddcdab51f41c369d6e3103d..460c6fd61bb45247715d99445821e15e98e4c465 100644
--- a/src/main/java/net/minecraft/world/entity/Entity.java
+++ b/src/main/java/net/minecraft/world/entity/Entity.java
@@ -2354,6 +2354,7 @@ public abstract class Entity implements Nameable, CommandSource, net.minecraft.s
}
+ public final int getMaxAirTicks() { return getMaxAirSupply(); } // Paper - OBFHELPER
public int getMaxAirSupply() {
return 300;
}