Paper/Spigot-Server-Patches/0209-Do-not-let-armorstands-drown.patch
2017-05-14 16:06:27 -05:00

46 Zeilen
1.8 KiB
Diff

From c2a37eb20a4c9821e051f945c3b199f60cd8823d 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 091c96411..693f157ea 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -771,5 +771,10 @@ public class EntityArmorStand extends EntityLiving {
super.move(moveType, x, y, z);
}
}
+
+ @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 1277ba3c2..ff2fe1b9d 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -189,6 +189,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.bL(); } // Paper - OBFHELPER
public boolean bL() {
return false;
}
@@ -223,7 +224,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(Material.WATER)) {
- if (!this.bL() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) {
+ if (!this.canBreatheUnderwater() && !this.hasEffect(MobEffects.WATER_BREATHING) && !flag1) {
this.setAirTicks(this.d(this.getAirTicks()));
if (this.getAirTicks() == -20) {
this.setAirTicks(0);
--
2.13.0