testserver/Spigot-Server-Patches/0141-Do-not-let-armorstands...

43 lines
2.1 KiB
Diff
Raw Normal View History

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Zach Brown <zach.brown@destroystokyo.com>
Date: Sat, 18 Feb 2017 19:29:58 -0600
Subject: [PATCH] Do not let armorstands drown
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 73e5bd74f6f9b1532d4abf8d8a0383c851daf35f..9017b98799bde141002282a2709a3ad943999ccb 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -830,5 +830,10 @@ public class EntityArmorStand extends EntityLiving {
2019-04-27 06:26:04 +00:00
super.move(moveType, vec3d);
}
}
+
+ @Override
+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization
+ return true;
+ }
// Paper end
}
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 6ba023e9a57f24538f06f456a64f054082b7f3ac..37ebefa8b1e4344a50643bcc13c31083f911d043 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -245,6 +245,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
2020-06-25 13:11:48 +00:00
+ public boolean canBreatheUnderwater() { return this.cL(); } // Paper - OBFHELPER
public boolean cL() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -288,7 +289,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
2020-06-25 13:11:48 +00:00
if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) {
- if (!this.cL() && !MobEffectUtil.c(this) && !flag1) {
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
this.setAirTicks(this.l(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);