Mirror von
https://github.com/PaperMC/Paper.git
synchronisiert 2024-12-22 06:20:06 +01:00
43 Zeilen
2.2 KiB
Diff
43 Zeilen
2.2 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/EntityLiving.java b/src/main/java/net/minecraft/world/entity/EntityLiving.java
|
||
|
index dd9c51b28e32389429887e9c9cef0a554eff8a40..036577b0237e9c8a7ab22ede7477eefa1abecf96 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()) {
|
||
|
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 2ef991aa7f739d3577fbbf4386064557e8f7c904..57e0ea95df34fab22d6c5868ab839d56a3fa85fc 100644
|
||
|
--- a/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||
|
+++ b/src/main/java/net/minecraft/world/entity/decoration/EntityArmorStand.java
|
||
|
@@ -872,5 +872,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
|
||
|
}
|