Paper/Spigot-Server-Patches/0141-Do-not-let-armorstands-drown.patch

43 lines
2.2 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/world/entity/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
index 2eee92f74a7c82ec7df05db6df79743b4345cc86..3d6b8fd09c07e78c0d786dff9658eb0089f853cf 100644
--- a/src/main/java/net/minecraft/world/entity/EntityLiving.java
+++ b/src/main/java/net/minecraft/world/entity/EntityLiving.java
@@ -338,6 +338,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.cM(); } // Paper - OBFHELPER
public boolean cM() {
return this.getMonsterType() == EnumMonsterType.UNDEAD;
}
@@ -381,7 +382,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
2020-06-25 15:11:48 +02:00
if (this.a((Tag) TagsFluid.WATER) && !this.world.getType(new BlockPosition(this.locX(), this.getHeadY(), this.locZ())).a(Blocks.BUBBLE_COLUMN)) {
- if (!this.cM() && !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);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
index f0f93b3ff0b98f916b5f63b37b0f9b5c7fa03c2e..e9ea670248eb0680cdff9a72412e9331fc57ff8a 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
@@ -871,5 +871,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
}