Merge branch 'master' into pre/1.13

This commit is contained in:
Zach Brown 2018-09-11 17:48:17 -04:00
commit 9fe29f979c
No known key found for this signature in database
GPG Key ID: CC9DA35FC5450B76

View File

@ -1,4 +1,4 @@
From 53605f51ade300b443bfcb5b147499ce9397b8b6 Mon Sep 17 00:00:00 2001 From 399e9456e54ee49d7bccb7ef65aa3dc3172237ae Mon Sep 17 00:00:00 2001
From: Phoenix616 <mail@moep.tv> From: Phoenix616 <mail@moep.tv>
Date: Tue, 21 Aug 2018 01:39:35 +0100 Date: Tue, 21 Aug 2018 01:39:35 +0100
Subject: [PATCH] Improve death events Subject: [PATCH] Improve death events
@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
internal code. internal code.
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java
index 63bdb96db8..96dd1a7fa4 100644 index 63bdb96db..96dd1a7fa 100644
--- a/src/main/java/net/minecraft/server/CombatTracker.java --- a/src/main/java/net/minecraft/server/CombatTracker.java
+++ b/src/main/java/net/minecraft/server/CombatTracker.java +++ b/src/main/java/net/minecraft/server/CombatTracker.java
@@ -163,6 +163,7 @@ public class CombatTracker { @@ -163,6 +163,7 @@ public class CombatTracker {
@ -27,7 +27,7 @@ index 63bdb96db8..96dd1a7fa4 100644
int i = this.f ? 300 : 100; int i = this.f ? 300 : 100;
if (this.g && (!this.b.isAlive() || this.b.ticksLived - this.c > i)) { if (this.g && (!this.b.isAlive() || this.b.ticksLived - this.c > i)) {
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
index bcd7af059e..f6c43bab46 100644 index bcd7af059..f6c43bab4 100644
--- a/src/main/java/net/minecraft/server/Entity.java --- a/src/main/java/net/minecraft/server/Entity.java
+++ b/src/main/java/net/minecraft/server/Entity.java +++ b/src/main/java/net/minecraft/server/Entity.java
@@ -1538,6 +1538,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke @@ -1538,6 +1538,7 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
@ -55,7 +55,7 @@ index bcd7af059e..f6c43bab46 100644
return SoundCategory.NEUTRAL; return SoundCategory.NEUTRAL;
} }
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
index 35afffedef..e8e7413748 100644 index 35afffede..e8e741374 100644
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java --- a/src/main/java/net/minecraft/server/EntityArmorStand.java
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java +++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
@@ -629,7 +629,8 @@ public class EntityArmorStand extends EntityLiving { @@ -629,7 +629,8 @@ public class EntityArmorStand extends EntityLiving {
@ -69,7 +69,7 @@ index 35afffedef..e8e7413748 100644
} }
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
index 890a3a02bd..fec7bf0a5d 100644 index 890a3a02b..4aea8e4c7 100644
--- a/src/main/java/net/minecraft/server/EntityLiving.java --- a/src/main/java/net/minecraft/server/EntityLiving.java
+++ b/src/main/java/net/minecraft/server/EntityLiving.java +++ b/src/main/java/net/minecraft/server/EntityLiving.java
@@ -76,14 +76,14 @@ public abstract class EntityLiving extends Entity { @@ -76,14 +76,14 @@ public abstract class EntityLiving extends Entity {
@ -140,7 +140,7 @@ index 890a3a02bd..fec7bf0a5d 100644
- this.aX = true; - this.aX = true;
- this.getCombatTracker().g(); - this.getCombatTracker().g();
+ //this.aX = true; + this.aX = true; // Paper - Always set at start, unset later if cancelled - GH-1432
+ //this.getCombatTracker().g(); + //this.getCombatTracker().g();
+ +
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = null; + org.bukkit.event.entity.EntityDeathEvent deathEvent = null;
@ -148,7 +148,7 @@ index 890a3a02bd..fec7bf0a5d 100644
if (!this.world.isClientSide) { if (!this.world.isClientSide) {
int i = 0; int i = 0;
@@ -1227,15 +1236,32 @@ public abstract class EntityLiving extends Entity { @@ -1227,15 +1236,33 @@ public abstract class EntityLiving extends Entity {
this.a(flag, i, damagesource); this.a(flag, i, damagesource);
// CraftBukkit start - Call death event // CraftBukkit start - Call death event
@ -178,13 +178,14 @@ index 890a3a02bd..fec7bf0a5d 100644
+ this.setDying(true); + this.setDying(true);
+ this.world.broadcastEntityEffect(this, (byte) 3); + this.world.broadcastEntityEffect(this, (byte) 3);
+ } else { + } else {
+ this.setDying(false); // Paper - reset if cancelled
+ this.setHealth((float) deathEvent.getReviveHealth()); + this.setHealth((float) deathEvent.getReviveHealth());
+ } + }
+ // Paper end + // Paper end
} }
} }
@@ -1289,6 +1315,7 @@ public abstract class EntityLiving extends Entity { @@ -1289,6 +1316,7 @@ public abstract class EntityLiving extends Entity {
return SoundEffects.ENTITY_GENERIC_HURT; return SoundEffects.ENTITY_GENERIC_HURT;
} }
@ -192,7 +193,7 @@ index 890a3a02bd..fec7bf0a5d 100644
@Nullable @Nullable
protected SoundEffect cs() { protected SoundEffect cs() {
return SoundEffects.ENTITY_GENERIC_DEATH; return SoundEffects.ENTITY_GENERIC_DEATH;
@@ -1706,10 +1733,12 @@ public abstract class EntityLiving extends Entity { @@ -1706,10 +1734,12 @@ public abstract class EntityLiving extends Entity {
} }
@ -206,7 +207,7 @@ index 890a3a02bd..fec7bf0a5d 100644
return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F; return this.isBaby() ? (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.5F : (this.random.nextFloat() - this.random.nextFloat()) * 0.2F + 1.0F;
} }
diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java diff --git a/src/main/java/net/minecraft/server/EntityPlayer.java b/src/main/java/net/minecraft/server/EntityPlayer.java
index 68f5842cfe..5ab4e01edf 100644 index 68f5842cf..5ab4e01ed 100644
--- a/src/main/java/net/minecraft/server/EntityPlayer.java --- a/src/main/java/net/minecraft/server/EntityPlayer.java
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java +++ b/src/main/java/net/minecraft/server/EntityPlayer.java
@@ -75,6 +75,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting { @@ -75,6 +75,10 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
@ -257,7 +258,7 @@ index 68f5842cfe..5ab4e01edf 100644
} }
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
index 17fab031b4..ee8219e3ba 100644 index 17fab031b..ee8219e3b 100644
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java --- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java +++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
@@ -674,6 +674,22 @@ public enum CraftSound { @@ -674,6 +674,22 @@ public enum CraftSound {
@ -284,7 +285,7 @@ index 17fab031b4..ee8219e3ba 100644
this.minecraftKey = minecraftKey; this.minecraftKey = minecraftKey;
} }
diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java diff --git a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
index b6cf96e187..96232aa078 100644 index b6cf96e18..96232aa07 100644
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java --- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java +++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
@@ -1711,7 +1711,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player { @@ -1711,7 +1711,15 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
@ -305,7 +306,7 @@ index b6cf96e187..96232aa078 100644
public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) { public void injectScaledMaxHealth(Collection<AttributeInstance> collection, boolean force) {
diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java diff --git a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
index ef8e7c6f64..83e9a60228 100644 index ef8e7c6f6..83e9a6022 100644
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java --- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java +++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
@@ -425,9 +425,16 @@ public class CraftEventFactory { @@ -425,9 +425,16 @@ public class CraftEventFactory {
@ -374,5 +375,5 @@ index ef8e7c6f64..83e9a60228 100644
* Server methods * Server methods
*/ */
-- --
2.18.0 2.19.0