Paper/Spigot-Server-Patches/0202-Do-not-let-armorstands-drown.patch
Aikar 094bb03a37
Optimize Hoppers
- Lots of itemstack cloning removed. Only clone if the item is actually moved
- Return true when a plugin cancels inventory move item event instead of false, as false causes pulls to cycle through all items.
  However, pushes do not exhibit the same behavior, so this is not something plugins could of been relying on.
- Add option (Default on) to cooldown hoppers when they fail to move an item due to full inventory
- Skip subsequent InventoryMoveItemEvents if a plugin does not use the item after first event fire for an iteration
2018-02-12 23:26:02 -05:00

46 lines
1.8 KiB
Diff

From 32462fe122bceb27d35a68cfae1e43abf1f5b15f 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 ee3d37a71..df0d66ad0 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -779,5 +779,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 6829f8f9c..4e7cf5de6 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -195,6 +195,7 @@ public abstract class EntityLiving extends Entity {
super.a(d0, flag, iblockdata, blockposition);
}
+ public boolean canBreatheUnderwater() { return this.bN(); } // Paper - OBFHELPER
public boolean bN() {
return false;
}
@@ -229,7 +230,7 @@ public abstract class EntityLiving extends Entity {
if (this.isAlive()) {
if (this.a(Material.WATER)) {
- if (!this.bN() && !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.16.1