if (packetIn.getOpCode() == 2) Entity entity = packetIn.getEntity(this.clientController.netClientHandler); if (entity != null && !entity.isEntityInvulnerable()) if (entity.hurtResistantTime <= 0) // Already triggered locally? entity.performHurtAnimation();

net.minecraft.client.network.NetHandlerPlayClient#handleEntityStatus Case 2 → Entity#performHurtAnimation() .

@Mixin(EntityPlayerSP.class) public abstract class MixinEntityPlayerSP @Inject(method = "sendUseEntity", at = @At("HEAD")) private void onSendAttackPacket(Entity entity, int action, float x, float y, float z, CallbackInfo ci) if (action == 0) // 0 = ATTACK if (entity != null) // Trigger hit visual client-side entity.performHurtAnimation(); // Play hurt sound locally entity.worldObj.playSound(entity.posX, entity.posY, entity.posZ, entity.getHurtSound(), entity.getSoundCategory(), 1.0f, 1.0f, false);