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

Wolf armor gets damaged when EntityDamageEvent is cancelled #10978

Closed
TothAdam0012 opened this issue Jun 24, 2024 · 6 comments
Closed

Wolf armor gets damaged when EntityDamageEvent is cancelled #10978

TothAdam0012 opened this issue Jun 24, 2024 · 6 comments
Labels
status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. type: bug Something doesn't work as it was intended to. version: 1.21 Game version 1.21

Comments

@TothAdam0012
Copy link

Expected behavior

Cancelling EntityDamageEvent should prevent wolf armor from taking damage since there's no incoming damage to defend against.

Observed/Actual behavior

Even though EntityDamageEvent is cancelled the wolf armor takes damage and eventually breaks.

Steps/models to reproduce

Create an empty plugin an register the following event

    @EventHandler
    public void onEntityDamage(EntityDamageEvent e) {
        if(e.getEntityType() == EntityType.WOLF) {
            e.setCancelled(true);
        }
    }

After summoning a wolf tame it and put armor on it. When the wolf gets hit by the player the armor takes damage.

Plugin and Datapack List

Empty/test plugin

Paper version

[22:56:28 INFO]: Checking version, please wait...
[22:56:30 INFO]: This server is running Paper version 1.21-37-master@dd49fba (2024-06-24T02:08:49Z) (Implementing API version 1.21-R0.1-SNAPSHOT)
You are running the latest version
Previous version: 1.21-27-76c2f16 (MC: 1.21)

Other

No response

@TothAdam0012 TothAdam0012 added status: needs triage type: bug Something doesn't work as it was intended to. labels Jun 24, 2024
@papermc-sniffer papermc-sniffer bot added the version: 1.21 Game version 1.21 label Jun 24, 2024
@papermc-projects papermc-projects bot moved this to 🕑 Needs Triage in Issues: Bugs Jun 24, 2024
@Doc94
Copy link
Contributor

Doc94 commented Jun 25, 2024

I check internally and looks like the event is called in actuallyHurts (in the final) what is only called if the wolf not has armor (or the damage ignore the wolf armor) currently in upstream is more easy fix that because the event now is created before the actuallyHurts is called and pass the event later to actuallyHurts where can check the cancel state for avoid damage the armor, but Paper has EntityDamageItemEvent what is called for damage in items like the Wolf Armor then you can use that for cancel the damage in Wolf Armor

@TothAdam0012
Copy link
Author

Shouldn't EntityDamageItemEvent not even get called for this and just not damage the item? Or maybe not damage the item and call the event in a cancelled state.

@Doc94
Copy link
Contributor

Doc94 commented Jun 25, 2024

Shouldn't EntityDamageItemEvent not even get called for this and just not damage the item? Or maybe not damage the item and call the event in a cancelled state.

In teory.. but i dont like that solution of just call EntityDamageItemEvent in canceled because that can cause another user cases fails if is just called in that part of code (currently... with the last upstreams changes in teory its just listen the canceled state passed in the hurts methods for wolfs)

@Goinging
Copy link

Goinging commented Jul 6, 2024

Pretty sure this is the issue you are talking about. https://hub.spigotmc.org/jira/browse/SPIGOT-7815

@Doc94
Copy link
Contributor

Doc94 commented Jul 6, 2024

Pretty sure this is the issue you are talking about. https://hub.spigotmc.org/jira/browse/SPIGOT-7815

yeah in Upstream was already fixed, but here need handle EntityDamageItemEvent for that until https://hub.spigotmc.org/stash/projects/SPIGOT/repos/craftbukkit/commits/66e78a96b65b15c41e3c180beaa72c390b9d6153#nms-patches%2Fnet%2Fminecraft%2Fworld%2Fentity%2Fanimal%2FEntityWolf.patch is merged here

@Machine-Maker Machine-Maker added status: accepted Disputed bug is accepted as valid or Feature accepted as desired to be added. and removed status: needs triage labels Jul 6, 2024
@papermc-projects papermc-projects bot moved this from 🕑 Needs Triage to ✅ Accepted in Issues: Bugs Jul 6, 2024
@CatTeaA
Copy link

CatTeaA commented Jul 18, 2024

Merge
#11102

@kennytv kennytv closed this as completed Jul 18, 2024
@github-project-automation github-project-automation bot moved this from ✅ Accepted to Done in Issues: Bugs Jul 18, 2024
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. type: bug Something doesn't work as it was intended to. version: 1.21 Game version 1.21
Projects
Status: Done
Development

No branches or pull requests

6 participants