PaperMC/patches/server-remapped/0141-Do-not-let-armorstands-drown.patch
2021-06-11 14:02:28 +02:00

42 lines
2.3 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/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index 3908f54e2216c635d47f8256bac455e7207a5bc6..c1786fcabeaee5732e9197db04268c5c4e164339 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -335,6 +335,7 @@ public abstract class LivingEntity extends Entity {
super.checkFallDamage(heightDifference, onGround, landedState, landedPosition);
}
+ public boolean canBreatheUnderwater() { return this.canBreatheUnderwater(); } // Paper - OBFHELPER
public boolean canBreatheUnderwater() {
return this.getMobType() == MobType.UNDEAD;
}
@@ -378,7 +379,7 @@ public abstract class LivingEntity extends Entity {
if (this.isAlive()) {
if (this.isEyeInFluid((Tag) FluidTags.WATER) && !this.level.getBlockState(new BlockPos(this.getX(), this.getEyeY(), this.getZ())).is(Blocks.BUBBLE_COLUMN)) {
- if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) {
+ if (!this.canBreatheUnderwater() && !MobEffectUtil.c(this) && !flag1) { // Paper - use OBFHELPER so it can be overridden
this.setAirSupply(this.decreaseAirSupply(this.getAirSupply()));
if (this.getAirSupply() == -20) {
this.setAirSupply(0);
diff --git a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
index 8b6ec9ddf0d47bf4369b247e764f75893ab15781..59239e202e8e99870ce3be515d2f040ad9786892 100644
--- a/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
+++ b/src/main/java/net/minecraft/world/entity/decoration/ArmorStand.java
@@ -868,5 +868,10 @@ public class ArmorStand extends LivingEntity {
super.move(type, movement);
}
}
+
+ @Override
+ public boolean canBreatheUnderwater() { // Skips a bit of damage handling code, probably a micro-optimization
+ return true;
+ }
// Paper end
}