From fd3e1799d3aa1cba1d49220f81629e4e068c205c Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Tue, 26 Dec 2023 07:42:19 +1100 Subject: [PATCH] SPIGOT-7462: Players no longer drop XP after dying near a Sculk Catalyst By: DerFrZocker --- .../net/minecraft/server/level/EntityPlayer.patch | 3 ++- .../net/minecraft/world/entity/EntityLiving.patch | 14 ++++++++------ 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch b/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch index 28710b9df4..c6c6c892d2 100644 --- a/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch +++ b/paper-server/nms-patches/net/minecraft/server/level/EntityPlayer.patch @@ -1016,7 +1016,7 @@ if (blockposition != null) { boolean flag2 = blockposition.equals(this.respawnPosition) && resourcekey.equals(this.respawnDimension); -@@ -1913,4 +2344,146 @@ +@@ -1913,4 +2344,147 @@ public CommonPlayerSpawnInfo createCommonSpawnInfo(WorldServer worldserver) { return new CommonPlayerSpawnInfo(worldserver.dimensionTypeId(), worldserver.dimension(), BiomeManager.obfuscateSeed(worldserver.getSeed()), this.gameMode.getGameModeForPlayer(), this.gameMode.getPreviousGameModeForPlayer(), worldserver.isDebug(), worldserver.isFlat(), this.getLastDeathLocation(), this.getPortalCooldown()); } @@ -1155,6 +1155,7 @@ + } + this.keepLevel = false; + this.setDeltaMovement(0, 0, 0); // CraftBukkit - SPIGOT-6948: Reset velocity on death ++ this.skipDropExperience = false; // CraftBukkit - SPIGOT-7462: Reset experience drop skip, so that further deaths drop xp + } + + @Override diff --git a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch index 703992a8fe..b7f4542c90 100644 --- a/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch +++ b/paper-server/nms-patches/net/minecraft/world/entity/EntityLiving.patch @@ -31,10 +31,12 @@ public abstract class EntityLiving extends Entity implements Attackable { private static final Logger LOGGER = LogUtils.getLogger(); -@@ -226,6 +250,20 @@ +@@ -225,7 +249,21 @@ + private float swimAmount; private float swimAmountO; protected BehaviorController brain; - private boolean skipDropExperience; +- private boolean skipDropExperience; ++ protected boolean skipDropExperience; + // CraftBukkit start + public int expToDrop; + public boolean forceDrops; @@ -536,7 +538,7 @@ + return i; + } else { + return 0; - } ++ } + } + // CraftBukkit end + @@ -545,7 +547,7 @@ + if (true && !(this instanceof net.minecraft.world.entity.boss.enderdragon.EntityEnderDragon)) { // CraftBukkit - SPIGOT-2420: Special case ender dragon will drop the xp over time + EntityExperienceOrb.award((WorldServer) this.level(), this.position(), this.expToDrop); + this.expToDrop = 0; -+ } + } + // CraftBukkit end } @@ -652,7 +654,7 @@ + }; + float blockingModifier = blocking.apply((double) f).floatValue(); + f += blockingModifier; -+ + + Function armor = new Function() { + @Override + public Double apply(Double f) { @@ -741,7 +743,7 @@ + absorptionModifier = (float) -event.getDamage(DamageModifier.ABSORPTION); + this.setAbsorptionAmount(Math.max(this.getAbsorptionAmount() - absorptionModifier, 0.0F)); + float f2 = absorptionModifier; - ++ + if (f2 > 0.0F && f2 < 3.4028235E37F && this instanceof EntityHuman) { + ((EntityHuman) this).awardStat(StatisticList.DAMAGE_ABSORBED, Math.round(f2 * 10.0F)); + }