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

EntityDamageByBlockEvent.getDamager() returning null for lava #11984

Open
Mitality opened this issue Jan 17, 2025 · 2 comments · May be fixed by #11991
Open

EntityDamageByBlockEvent.getDamager() returning null for lava #11984

Mitality opened this issue Jan 17, 2025 · 2 comments · May be fixed by #11991
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.21.4 Game version 1.21.4

Comments

@Mitality
Copy link

Expected behavior

Up to version 1.21.1, EntityDamageByBlockEvent.getDamager() returns the block responsible for the damage dealt as a valid Block object for damage caused by lava. I therefore expected it to work that way in newer versions too, as it's most certainly the expected behavior of this method in this case.

Observed/Actual behavior

On 1.21.3+, EntityDamageByBlockEvent.getDamager() just returns null for damage caused by lava.

Steps/models to reproduce

Here's what I did:

  • Create 2 localhost servers, one with PaperMC 1.21.1 and the other one with PaperMC 1.21.3 (newest builds).
    (no changes to those servers except accepting the eula)

  • Create a minimalistic plugin to log EntityDamageByBlockEvent.getDamager().

  • Join both servers, grab a bucket of lava and take a bath.

  • Compare console output:
    1.21.1: CraftBlock{...}
    1.21.3: null

Plugin and Datapack List

Just the minimalistic logging plugin:

public final class GetDamagerTest extends JavaPlugin implements Listener {

    @Override
    public void onEnable() {
        getServer().getPluginManager().registerEvents(this, this);
    }

    @Override
    public void onDisable() {}

    @EventHandler
    public void onDamageByBlock(EntityDamageByBlockEvent event) {
        Bukkit.getLogger().info(event.getDamager());
    }
}

Paper version

1.21.1#132 & 1.21.3#82

Other

No response

@lynxplay
Copy link
Contributor

Caused by the moonrise patch, patching over CB setting Entity.lastLavaContact in Entity#updateFluidHeightAndDoFluidPushing

Might be worth looking for a better alternative to this field tho (if there is one)

@lynxplay lynxplay added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.21.4 Game version 1.21.4 and removed status: needs triage labels Jan 17, 2025
@Lulu13022002 Lulu13022002 changed the title EntityDamageByBlockEvent.getDamager() returning null for lava and possibly more damage sources EntityDamageByBlockEvent.getDamager() returning null for lava Jan 17, 2025
@Doc94
Copy link
Contributor

Doc94 commented Jan 19, 2025

Caused by the moonrise patch, patching over CB setting Entity.lastLavaContact in Entity#updateFluidHeightAndDoFluidPushing

Might be worth looking for a better alternative to this field tho (if there is one)

hmmm a little hard its not valid just re add the set of that field in the updateFluidHeightAndDoFluidPushing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. version: 1.21.4 Game version 1.21.4
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants