Paper/Spigot-Server-Patches/0143-Do-not-let-armorstands...

43 lines
2.1 KiB
Diff

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 176af6c889fa29d5df7c822f888cdc26f81110e6..992d7bfb0fd26540fbdeaf8d7845e8c2c81d608b 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -826,5 +826,10 @@ public class EntityArmorStand extends EntityLiving {
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 f4d68a5f0a6d28f278596cb6787d070bacd792a4..28d873d8fe7bb79d2a84eb9bf234ac8ba0223813 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -227,6 +227,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.cB(); } // Paper - OBFHELPER
public boolean cB() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -266,7 +267,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).getBlock() != Blocks.BUBBLE_COLUMN) {
- if (!this.cB() && !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);