Updated Upstream (Bukkit/CraftBukkit/Spigot) (#2415)
* fixup patch and rebuild * Updated Upstream (Bukkit/CraftBukkit/Spigot) Upstream has released updates that appears to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: bde198c9 SPIGOT-5246: PlayerQuitEvent.get/setQuitMessage() is incorrectly marked as NotNull 24ad5a79 SPIGOT-5240: Vector.angle not valid for angles very close to each other a143db9a SPIGOT-5231: ShotAtAngle API for Fireworks 10db5c3d SPIGOT-5226: Update Javadoc of PlayerDeathEvent CraftBukkit Changes: 1ec1b05e SPIGOT-5245: Unneeded cast to WorldNBTStorage in CraftWorld#getWorldFolder e5e8eec2 SPIGOT-5241: setAttributeModifiers does not work on untouched stack 803eaa31 SPIGOT-5231: ShotAtAngle API for Fireworks 7881d2ae SPIGOT-5237: Horses, pigs do not drop their inventory 06efc9ec Don't accept connections until all plugins have enabled da62a66a SPIGOT-5225: World handle isn't closed if world is unloaded without saving 104b3831 SPIGOT-5222: Cannot get Long values from Entity memory f0b3fe43 SPIGOT-5220: Server CPU usage reaches 100% when stdin is null Spigot Changes: e5b1b5db SPIGOT-5235: Destroy expired area effect clouds / fireworks that are inactive cbcc8e87 Make region files more reliable to write to 8887c5f4 Remove redundant late-bind option dac29063 Rebuild patches * Preserve old flush on save flag for reliable regionfiles Originally this patch was in paper * Fix some issues with the death event - Entities potentially entering a glitched state to the client where they appear to be falling over - Donkeys losing their chest if the event was cancelled (only an issue since the upstream merge) - Some wither death logic running for an entity killed by a wither
This commit is contained in:
@@ -15,7 +15,7 @@ items and experience which is otherwise only properly possible by using
|
||||
internal code.
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/CombatTracker.java b/src/main/java/net/minecraft/server/CombatTracker.java
|
||||
index 84c3ea9d0..f563a7b63 100644
|
||||
index 84c3ea9d00..f563a7b630 100644
|
||||
--- a/src/main/java/net/minecraft/server/CombatTracker.java
|
||||
+++ b/src/main/java/net/minecraft/server/CombatTracker.java
|
||||
@@ -0,0 +0,0 @@ public class CombatTracker {
|
||||
@@ -27,7 +27,7 @@ index 84c3ea9d0..f563a7b63 100644
|
||||
int i = this.f ? 300 : 100;
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/Entity.java b/src/main/java/net/minecraft/server/Entity.java
|
||||
index 7811beb80..f9b097fd6 100644
|
||||
index 7811beb807..f9b097fd6f 100644
|
||||
--- a/src/main/java/net/minecraft/server/Entity.java
|
||||
+++ b/src/main/java/net/minecraft/server/Entity.java
|
||||
@@ -0,0 +0,0 @@ public abstract class Entity implements INamableTileEntity, ICommandListener, Ke
|
||||
@@ -47,7 +47,7 @@ index 7811beb80..f9b097fd6 100644
|
||||
|
||||
protected void i(double d0, double d1, double d2) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityArmorStand.java b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
index 627925e3b..e516db270 100644
|
||||
index 627925e3ba..e516db2701 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityArmorStand.java
|
||||
@@ -0,0 +0,0 @@ public class EntityArmorStand extends EntityLiving {
|
||||
@@ -61,7 +61,7 @@ index 627925e3b..e516db270 100644
|
||||
}
|
||||
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityFox.java b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
index 85231309f..1da2f013f 100644
|
||||
index 85231309fd..97059b8239 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityFox.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityFox.java
|
||||
@@ -0,0 +0,0 @@ public class EntityFox extends EntityAnimal {
|
||||
@@ -74,7 +74,7 @@ index 85231309f..1da2f013f 100644
|
||||
+ ItemStack itemstack = this.getEquipment(EnumItemSlot.MAINHAND).cloneItemStack(); // Paper
|
||||
+
|
||||
+ // Paper start - Cancellable death event
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.d(damagesource);
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = super.processDeath(damagesource);
|
||||
+
|
||||
+ // Below is code to drop
|
||||
+
|
||||
@@ -93,8 +93,33 @@ index 85231309f..1da2f013f 100644
|
||||
}
|
||||
|
||||
public static boolean a(EntityFox entityfox, EntityLiving entityliving) {
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
||||
index 2483cfd28a..2a988366cd 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityHorseChestedAbstract.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityHorseChestedAbstract extends EntityHorseAbstract {
|
||||
this.a((IMaterial) Blocks.CHEST);
|
||||
}
|
||||
|
||||
- this.setCarryingChest(false);
|
||||
+ //this.setCarryingChest(false); // Paper - moved to post death logic
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+ // Paper start
|
||||
+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {
|
||||
+ if (this.isCarryingChest() && (event == null || !event.isCancelled())) {
|
||||
+ this.setCarryingChest(false);
|
||||
+ }
|
||||
+ }
|
||||
+ // Paper end
|
||||
+
|
||||
@Override
|
||||
public void b(NBTTagCompound nbttagcompound) {
|
||||
super.b(nbttagcompound);
|
||||
diff --git a/src/main/java/net/minecraft/server/EntityLiving.java b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
index edc25586a..37ff76486 100644
|
||||
index b09712ca91..1e53af2cce 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityLiving.java
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
@@ -175,8 +200,19 @@ index edc25586a..37ff76486 100644
|
||||
+
|
||||
boolean flag = false;
|
||||
|
||||
if (entityliving instanceof EntityWither) {
|
||||
- if (entityliving instanceof EntityWither) {
|
||||
+ if (this.killed && entityliving instanceof EntityWither) {
|
||||
if (this.world.getGameRules().getBoolean(GameRules.MOB_GRIEFING)) {
|
||||
BlockPosition blockposition = new BlockPosition(this.locX, this.locY, this.locZ);
|
||||
IBlockData iblockdata = Blocks.WITHER_ROSE.getBlockData();
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
}
|
||||
}
|
||||
|
||||
+ if (this.killed) { // Paper
|
||||
this.world.broadcastEntityEffect(this, (byte) 3);
|
||||
this.setPose(EntityPose.DYING);
|
||||
+ } // Paper
|
||||
}
|
||||
}
|
||||
|
||||
@@ -187,10 +223,10 @@ index edc25586a..37ff76486 100644
|
||||
int i;
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
|
||||
boolean flag = this.lastDamageByPlayerTime > 0;
|
||||
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent = null; // Paper
|
||||
this.cF(); // CraftBukkit - from below // PAIL
|
||||
+ org.bukkit.event.entity.EntityDeathEvent deathEvent; // Paper
|
||||
if (this.isDropExperience() && this.world.getGameRules().getBoolean(GameRules.DO_MOB_LOOT)) {
|
||||
this.a(damagesource, flag);
|
||||
this.dropDeathLoot(damagesource, i, flag);
|
||||
@@ -198,19 +234,23 @@ index edc25586a..37ff76486 100644
|
||||
- CraftEventFactory.callEntityDeathEvent(this, this.drops);
|
||||
- this.drops = new ArrayList<org.bukkit.inventory.ItemStack>();
|
||||
+ deathEvent = CraftEventFactory.callEntityDeathEvent(this, this.drops); // Paper
|
||||
+ if (!deathEvent.isCancelled()) this.drops = new ArrayList<org.bukkit.inventory.ItemStack>(); // Paper
|
||||
} else {
|
||||
- CraftEventFactory.callEntityDeathEvent(this);
|
||||
+ deathEvent = CraftEventFactory.callEntityDeathEvent(this); // Paper
|
||||
// CraftBukkit end
|
||||
}
|
||||
+ this.postDeathDropItems(deathEvent); // Paper
|
||||
+ this.drops = new ArrayList<>(); // Paper
|
||||
|
||||
- this.cF();
|
||||
+ if (!deathEvent.isCancelled()) this.cF();; // Paper
|
||||
- // this.cF();// CraftBukkit - moved up
|
||||
+ return deathEvent; // Paper
|
||||
}
|
||||
|
||||
protected void cF() {}
|
||||
+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) {} // Paper - method for post death logic that cannot be ran before the event is potentially cancelled
|
||||
|
||||
protected void dropDeathLoot(DamageSource damagesource, int i, boolean flag) {}
|
||||
|
||||
@@ -0,0 +0,0 @@ public abstract class EntityLiving extends Entity {
|
||||
return SoundEffects.ENTITY_GENERIC_HURT;
|
||||
}
|
||||
@@ -233,7 +273,7 @@ index edc25586a..37ff76486 100644
|
||||
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
|
||||
index dcd48d8b3..d7bc6e329 100644
|
||||
index dcd48d8b3d..d7bc6e3297 100644
|
||||
--- a/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
+++ b/src/main/java/net/minecraft/server/EntityPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class EntityPlayer extends EntityHuman implements ICrafting {
|
||||
@@ -284,7 +324,7 @@ index dcd48d8b3..d7bc6e329 100644
|
||||
}
|
||||
}
|
||||
diff --git a/src/main/java/org/bukkit/craftbukkit/CraftSound.java b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
index 73cb64e09..9f317ff2e 100644
|
||||
index 73cb64e09d..9f317ff2e8 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/CraftSound.java
|
||||
@@ -0,0 +0,0 @@ public enum CraftSound {
|
||||
@@ -311,7 +351,7 @@ index 73cb64e09..9f317ff2e 100644
|
||||
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
|
||||
index 2c99a1e9d..e9458dc65 100644
|
||||
index 2c99a1e9df..e9458dc65f 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/entity/CraftPlayer.java
|
||||
@@ -0,0 +0,0 @@ public class CraftPlayer extends CraftHumanEntity implements Player {
|
||||
@@ -332,7 +372,7 @@ index 2c99a1e9d..e9458dc65 100644
|
||||
|
||||
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
|
||||
index 5309a4e30..4074100c4 100644
|
||||
index 5309a4e304..4074100c44 100644
|
||||
--- a/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
+++ b/src/main/java/org/bukkit/craftbukkit/event/CraftEventFactory.java
|
||||
@@ -0,0 +0,0 @@ public class CraftEventFactory {
|
||||
|
||||
Reference in New Issue
Block a user