diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch index e6413834b5a7..a0b02fb2905d 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch @@ -931,7 +931,7 @@ + killer.awardKillScore(this, source); + } + }); // Paper end -+ this.postDeathDropItems(deathEvent); // Paper ++ if (!deathEvent.isCancelled()) this.postDeathEventCallback(); // Paper - post death event logic + this.drops = new java.util.ArrayList<>(); + // this.dropEquipment(level); // CraftBukkit - moved up + // CraftBukkit end @@ -941,7 +941,7 @@ protected void dropEquipment(final ServerLevel level) { } -+ 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 postDeathEventCallback() {} // Paper - method for post death logic that must be ran if the event isn't cancelled - protected void dropExperience(final ServerLevel level, final @Nullable Entity killer) { + public int getExpReward(final ServerLevel level, final @Nullable Entity killer) { // CraftBukkit diff --git a/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch index fa3e3bce9f23..8f51f7150644 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/Mob.java.patch @@ -108,7 +108,7 @@ this.dropChances = input.read("drop_chances", DropChances.CODEC).orElse(DropChances.DEFAULT); this.readLeashData(input); this.homeRadius = input.getIntOr("home_radius", -1); -@@ -401,6 +_,13 @@ +@@ -401,11 +_,24 @@ this.lootTable = input.read("DeathLootTable", LootTable.KEY_CODEC); this.lootTableSeed = input.getLongOr("DeathLootTableSeed", 0L); this.setNoAi(input.getBooleanOr("NoAI", false)); @@ -122,6 +122,17 @@ } @Override + protected void dropFromLootTable(final ServerLevel level, final DamageSource source, final boolean playerKilled) { + super.dropFromLootTable(level, source, playerKilled); ++ // Paper start - delay loot table removal to after death event ++ } ++ @Override ++ protected void postDeathEventCallback() { ++ if (!this.shouldDropLoot((ServerLevel) this.level())) return; // This callback can only be ran if the level is a ServerLevel ++ // Paper end - delay loot table removal to after death event + this.lootTable = Optional.empty(); + } + @@ -465,6 +_,11 @@ for (ItemEntity entity : this.level() .getEntitiesOfClass(ItemEntity.class, this.getBoundingBox().inflate(pickupReach.getX(), pickupReach.getY(), pickupReach.getZ()))) { diff --git a/paper-server/patches/sources/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java.patch index 5e1eb25224f2..e72165075e84 100644 --- a/paper-server/patches/sources/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java.patch +++ b/paper-server/patches/sources/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java.patch @@ -1,14 +1,16 @@ --- a/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java +++ b/net/minecraft/world/entity/animal/equine/AbstractChestedHorse.java -@@ -75,6 +_,12 @@ +@@ -75,6 +_,14 @@ super.dropEquipment(level); if (this.hasChest()) { this.spawnAtLocation(level, Blocks.CHEST); + // Paper start - moved to post death logic + } + } -+ protected void postDeathDropItems(org.bukkit.event.entity.EntityDeathEvent event) { -+ if (this.hasChest() && !event.isCancelled()) { ++ @Override ++ protected void postDeathEventCallback() { ++ super.postDeathEventCallback(); ++ if (this.hasChest()) { + // Paper end - moved to post death logic this.setChest(false); }