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

46 lines
2.0 KiB
Diff
Raw Normal View History

2019-04-27 06:26:04 +00:00
From 2cf238ab74719beb6cb72b9e8826bb4a387a820d 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
2019-04-27 06:26:04 +00:00
index 8c6a9ec68..f8cd62199 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
2019-04-27 06:26:04 +00:00
@@ -797,5 +797,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
2019-04-27 06:26:04 +00:00
index b0c9eda48..121925046 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
2019-04-27 06:26:04 +00:00
@@ -223,6 +223,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
2019-04-27 06:26:04 +00:00
+ public boolean canBreatheUnderwater() { return this.cl(); } // Paper - OBFHELPER
public boolean cl() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
2019-04-27 06:26:04 +00:00
@@ -258,7 +259,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(TagsFluid.WATER) && this.world.getType(new BlockPosition(this.locX, this.locY + (double) this.getHeadHeight(), this.locZ)).getBlock() != Blocks.BUBBLE_COLUMN) {
2019-04-27 06:26:04 +00:00
- 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.k(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
--
2.21.0