Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

method setLastHurtByPlayer doesn't behave how the field lastHurtByPlayer is used in vanilla #2010

Open
Corail31 opened this issue Mar 7, 2025 · 0 comments
Labels
triage Needs triaging and confirmation

Comments

@Corail31
Copy link

Corail31 commented Mar 7, 2025

Minecraft Version: 1.21.4 (and below)

NeoForge Version: 21.4.100-beta

Steps to Reproduce:

  1. Checks where is used the method setLastHurtByPlayer(player) : it's used only in method setTarget(livingEntity) in ZombifiedPiglin class.
  2. Looks the method hurt(damageSource, amount) in livingEntity class which set lastHurtByPlayerTime to 100 (and not tickCount like in setLastHurtByPlayer(player)
  3. Checks the baseTick in livingEntity which decreases each tick 1 from lastHurtByPlayerTime until it reaches 0 and set lastHurtByPlayer to null

Description of issue:
The method setLastHurtByPlayer(player) doesn't seem correct and should be 100, which corresponds to the last 5 seconds that a player hit a creature.
The field lastHurtByPlayer is used for LootParams, for tamable entities and kill credit.

Code

public void setLastHurtByPlayer(@Nullable Player player) {
      this.lastHurtByPlayer = player;
      this.lastHurtByPlayerTime = this.tickCount;
  }

Additional Infos
An issue solved by vanilla in 25w02a (8/1/2025) so, i suppose it's related.

Zombified Piglins now need to be killed by a Player to drop the Player-specific loot.
This makes them consistent with all other mobs in the game.

https://www.minecraft.net/en-us/article/minecraft-snapshot-25w02a
https://bugs.mojang.com/browse/MC/issues/MC-56653

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage Needs triaging and confirmation
Projects
None yet
Development

No branches or pull requests

1 participant