Fix CombatTracker stale on death (#12562)

This commit is contained in:
Pedro
2025-05-21 12:19:08 -04:00
committed by GitHub
parent f303a076bc
commit 87349c317f
2 changed files with 13 additions and 7 deletions

View File

@@ -10,8 +10,6 @@ import java.util.Set;
import java.util.UUID;
import net.minecraft.Optionull;
import io.papermc.paper.world.damagesource.CombatTracker;
import io.papermc.paper.world.damagesource.PaperCombatTrackerWrapper;
import io.papermc.paper.world.damagesource.FallLocationType;
import net.minecraft.core.component.DataComponents;
import net.minecraft.network.protocol.game.ClientboundHurtAnimationPacket;
import net.minecraft.server.level.ServerLevel;
@@ -94,14 +92,11 @@ import org.bukkit.util.Vector;
public class CraftLivingEntity extends CraftEntity implements LivingEntity {
private final PaperCombatTrackerWrapper combatTracker;
private CraftEntityEquipment equipment;
public CraftLivingEntity(final CraftServer server, final net.minecraft.world.entity.LivingEntity entity) {
super(server, entity);
this.combatTracker = new PaperCombatTrackerWrapper(entity.getCombatTracker());
if (entity instanceof Mob || entity instanceof ArmorStand) {
this.equipment = new CraftEntityEquipment(this);
}
@@ -1168,6 +1163,6 @@ public class CraftLivingEntity extends CraftEntity implements LivingEntity {
@Override
public CombatTracker getCombatTracker() {
return this.combatTracker;
return this.getHandle().getCombatTracker().paperCombatTracker;
}
}