mojira.dev
MC-100991

Killing entities with a fishing rod doesn't count as a kill

The bug

When you yank someone into the lava or yank them from a high place to make them fall, it doesn't count as a kill. It just says the message as if the player killed him or her self rather then the fishing rod user killing the player. And it doesn't increment the player's stat.playerkills and the totalKillCount score.

Code analysis

Code analysis by @unknown can be found in this comment.

Related issues

Attachments

Comments

migrated
[media]
marcono1234

The reason why this is happening is because the class net.minecraft.entity.projectile.EntityFishHook is not dealing damage to the player. This way the CombatTracker does not track this. The method net.minecraft.entity.projectile.EntityFishHook.func_184527_k() (pulling an entity) could for example get the CombatTracker of the caught entity and make it track this event.

The following only shows an example, however the damage type is not completely correct.

protected void func_184527_k()
{
    double d0 = this.angler.posX - this.posX;
    double d1 = this.angler.posY - this.posY;
    double d2 = this.angler.posZ - this.posZ;
    double d3 = (double)MathHelper.sqrt_double(d0 * d0 + d1 * d1 + d2 * d2);
    double d4 = 0.1D;
    this.caughtEntity.motionX += d0 * d4;
    this.caughtEntity.motionY += d1 * d4 + (double)MathHelper.sqrt_double(d3) * 0.08D;
    this.caughtEntity.motionZ += d2 * d4;
    
    // Added this
    // Imported net.minecraft.entity.EntityLivingBase
    if (this.caughtEntity instanceof EntityLivingBase) {
        EntityLivingBase entityLivingBase = (EntityLivingBase) this.caughtEntity;
        
        entityLivingBase.getCombatTracker().trackDamage(DamageSource.causeThrownDamage(this, this.angler), entityLivingBase.getHealth(), 0f);
    }
}

There is however a problem that the CombatTracker resets pretty fast.

migrated

I'm quite surprised that barely anyone has noticed that this is a bug; but it might be because not a lot of people have realized that the fishing rod got updated to yank people properly. It's super ironic to me that my ticket isn't marked as a duplicate, because I really did expected for there to be a already reported ticket that I probably couldn't find in the search engine, and I think I've might of found another bug with the fishing rod, which I'll need to do further testing before I can report it.

marcono1234

I did not notice it myself, I just saw the report and got interested 🙂

Is the other bug maybe MC-87988?

migrated

No, it's this one:MC-101033

Avoma

Can confirm in 20w48a. I've attached a video of this occurring.

Brevort

Occurs with mobs as well per MC-225794.

migrated

(Unassigned)

Confirmed

Platform

Low

Items

death, fishing, fishing_rod, statistics

Minecraft 1.9.2, Minecraft 16w14a, Minecraft 16w15a, Minecraft 16w15b, Minecraft 1.10.2, ..., 1.20.6, 24w18a, 1.21, 1.21.4, 25w02a

Retrieved