mojira.dev
MC-158205

Ender Dragon doesn't take damage from melee attacks unless hit a certain way

When fighting the ender dragon, melee attacks sometimes don't register at all.

On the middle hitbox where the torso is ubicated, hits don't register from the center of the model towards the tail. Instead, they are only registering near the head, and only on certain weird angles. From what i've seen, the other hitboxes where the head and tail are located seem to be unaffected. Another important thing to say is that wings don't ever register hits (more info in the comments).

Basically, melee attacks done facing to the back or middle of the model don't register, seems to depend on the dragon's or player's position. Arrows however, always register.

Code Analysis

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

This issue appears to be caused by two root problems:

  1. There is a desync between client and server for entity IDs for the small hitboxes the dragon is composed of due to an off-by-one error (see MC-274526)

  2. The hit detection used by the game does not account for the fact that due to its size, the dragon entity can be located in a chunk the player is not looking at (see MC-261638, also affects other entities with large hitboxes)

Related issues

Attachments

Comments

migrated
[media][media][media][media][media][media][media][media][media][media][media]
migrated

this is intended the dragon will not be able to take damage for part of the landing stage of the fight

migrated

Try to get underneath it

migrated

Can confirm. The hitbox is buggy and weird. This also happens even when the dragon is not on the nest. Trying to fight it with a sword (for example by chasing it with elytra) is almost impossible as the hits don't register correctly. When you hit the dragon, the weapon makes a sound and you can see particles if the weapon is enchanted (see pictures), but no damage is dealt. I've seen videos where people were very frustrated by this, as it feels inconsistent and buggy when compared to how hits normally work. 

gaspoweredpick

Confirmed. The ender dragon isn't taking damage from places it did before.

SeaOfPixels

Not to mention the way the dragon descends to the fountain is bugged

syarumi

Can i request ownership? user's last activity was august 2019.

migrated

in 1.15.2 there could be the problem where the dragon doesn't change state correctly, it will never activate the landing sequence.

syarumi

Ric, if you want the ticket back you can ask a mod and i'll accept, i just requested ownership to keep updating the affected versions. And about the dragon hitboxes, that's probably being tracked as MC-111009.

FaRo1

Seems like only the head and tail hitboxes work properly, the torso works sometimes, I couldn't really figure out when. The wing hitboxes don't seem to work at all.
(Confirmed in 1.16.1, but that doesn't help.)

migrated

This seems very inconsistent. I have killed the dragon 3 times in the same game (survival, 1.16.2). The first two times the fight went normally. The third time, I hit the dragon once with my sword, and after that no further melee hits registered. I had to finish the fight using only bow and arrows.

Edit: 4th fight

I upgraded my game to 1.16.3 and set up another dragon fight. Initially my sword did damage, but then it stopped when hitting the rear end. Hitting near the front seemed to work a little longer. I re-logged mid-fight and the sword started working again briefly, before stopping again. After a second re-log the sword came back to life and I finished the fight.

Edit #2: Subsequent Fights

I have now killed the dragon 4 more times. Most of the time the fight proceeded normally. A couple of occasions hits from the sword stopped working. I used the workaround, wait til the dragon sits on the pedestal, re-log and then continue. Worked every time.

TLDR: this seems to be an intermittent problem. A (risky) workaround is to re-log while the dragon is on top of the pedestal.

 

SeaOfPixels

These are the kinds of major bugs that baffle me when they're not fixed asap, while other trivial bugs are prioritized.

SeaOfPixels

**Can confirm this bug first appeared in 19w08b, alongside many other serious bugs with the Ender Dragon that are still in the latest version. These issues include its hitbox, the way it descends to the fountain, and just its AI in general.

insane96mcp

I'm pretty sure there's some kind of desync problem as sometimes when in creative you try to hit her (melee) you can't (with a weapon you see the Sharpness particles but no hit is registered).

 

EDIT: Found out MC-225055

insane96mcp

With mods magic I've managed to summon at the actual position of the ender dragon's parts (head, neck, wings and tail) some angry villager particles. (Tested in singleplayer) As you can see the client sees the dragon there (both hitboxes and actual model) while on the server she's ahead.

[media]

The tail parts:

[media]

 

insane96mcp

Finally after two hours of debugging I've found out why you can't hit the dragon sometimes. It has to do with where the dragon is (chunk wise) and where you're aiming at.

But first off, why can't you hit wings? Seems like they're swapped between client and server. So if right wing has Entity ID 1 and left wing has Entity ID 2 on the client, for the server it'll be Entity ID 2 for the right wing and Entity ID 1 for the left wing. With this the server thinks that you're hitting the far away wing so since there's a max range for the hit of 6 blocks you can't reach it and so the hit is registered on the client (MC-225055) but not on the server.

For the problems about not hitting her at all is a little bit more complicated.
The problem arises when you aim at any of the dragon's part: if you're aiming at the chunk in the direction where the center position of the dragon is you'll hit her, otherwise the hit will miss, that's because the ender dragon is not found in the chunks you're raycasting in so the hitboxes aren't checked at all.

Let's make an example.
Here the player, the ender dragon's head hitbox and the ender dragon position are all in chunk 0,0. When the player tries to hit the Ender Dragon's head he searches for the Ender dragon in Chunk 0,0 and -1,0 (the direction looking). The dragon is found in 0,0 so raycasts are made to find the head and in the end (pun intended), the attack lands, dealing damage to the dragon.

[media]

In this case the hit will not land as the Ender Dragon is searched for in chunks -1,0 and -1,-1, but she's in 0,0 thus not found, the finding of the head is not done and the hit fails.

[media]

"Why most of the times I can hit her while in the portal?"
Because the raycast actually starts from 2 blocks behind the player so most of the times 0,0 will be searched for the dragon.

[media]

While in this case your hitbox doesn't load 0,0 so the dragon is not found and the hits will not land

[media]

 

Note that in the examples the Ender Dragon center position is always in 0,0 but can be in any of the 4 chunks when slightly off.

migrated

Affects 21w42a

migrated

Maybe this issue is relative with that?

https://github.com/MinecraftForge/MinecraftForge/issues/8188

 

SeaOfPixels

Can confirm in 1.19.3 pre3. I think you should add to the report that this bug (as well as other ender dragon bugs like its fountain descent and pathfinding) all appeared due to a fix in 19w08b.

SeaOfPixels

Can confirm in 23w18a.

SeaOfPixels

Can confirm in 1.20 release canidate 1

SeaOfPixels

Can confirm in 1.20.1

SeaOfPixels

Can confirm in 23w31a.

SeaOfPixels

Can confirm in 23w32a.

SeaOfPixels

Can confirm in 1.20.2

SeaOfPixels

Can confirm in 23w40a

SeaOfPixels

In 23w43a.

SeaOfPixels

Can confirm in 23w51a/23w51b

SeaOfPixels

Can confirm in 24w06a, affects wind charges

SeaOfPixels

Confirmed in 24w07a

syarumi

Just a reminder, you don't need to comment "affects version" everytime there's a snapshot out, you'll just spam emails to those watching the issue. Just confirm an affected version when there's a significant change or bugfix that could be related to this bug.

SeaOfPixels

This is also a parity issue with Bedrock Edition (also can confirm in the latest versions).

SeaOfPixels

Confirmed in 1.20.5 pre1

SeaOfPixels

{*}{*}Can confirm in 1.20.6-rc1

violine1101

I've added a brief summary of the findings by @unknown and from MC-274526 to the description.

The second issue with the raycast not working properly does not only affect the ender dragon but large mobs in general. With the recently added scale attribute, it is easily reproducible with other mobs too. I'll file a separate bug report about this for that reason. This has already been reported here: MC-261638.

SeaOfPixels

Relates to MC-271337, both issues appeared first in 19w08b.

syarumi

Shugoh

Confirmed

Platform

Important

Combat, Entities, Hitboxes

1.14.4, 1.15.2, 20w06a, 20w09a, 20w11a, ..., 24w14a, 1.20.5 Pre-Release 1, 1.20.5, 1.20.6 Release Candidate 1, 1.21

24w44a

Retrieved