mojira.dev
MC-111656

Some non-interactable entities do not override canBeAttackedWithItem() causing sounds when you hit them

Based on 1.11 decompiled using MCP 9.35 rc1

The bug

Some non-interactable entities like area effect clouds do not override the method net.minecraft.entity.Entity.canBeAttackedWithItem() to return false. This results in the sounds for the sound event entity.player.attack.nodamage being played and the held weapon having to recharge even though you cannot attack the entity in any situation.

Affected entities (vanilla)

These are the entities which can be punched using a vanilla client.

List might be incomplete, last updated for 1.12

  • tnt

Affected entities (modded)

These are the entities which can be punched using a modded client which ignores if Entity.canBeCollidedWith() returns true.

List might be incomplete, last updated for 1.12

  • area_effect_cloud

  • egg

  • ender_pearl

  • llama_spit

  • potion

  • snowball

  • xp_bottle

  • dragon_fireball

Linked issues

Comments 7

Does this problem still affect Minecraft 1.11.1?

It probably does, but the impact of this bug is near 0 so it might be closed as invalid anyways

Out of your list, I can only hear sounds with primed TNT in 1.12.

Can confirm in 21w05a.

Can confirm in 21w05b.

Can confirm in 1.16.5 and 21w08b. As stated above, I can only reproduce this with primed TNT.

Can confirm in 1.19.

marcono1234

(Unassigned)

Confirmed

Sound

attack, entity

Minecraft 1.11, Minecraft 1.11.2, Minecraft 1.12, Minecraft 1.12.2, Minecraft 18w02a, ..., 1.16.5, 21w05a, 21w05b, 21w08b, 1.19

Retrieved